Skip to content

Commit

Permalink
Implement "push tag to release"
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Dec 9, 2023
1 parent ee3326b commit 9d1248d
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 39 deletions.
3 changes: 3 additions & 0 deletions .bcr/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fixedReleaser:
login: fmeum
email: fabian@meumertzhe.im
15 changes: 15 additions & 0 deletions .bcr/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"homepage": "https://github.com/fmeum/buildozer",
"maintainers": [
{
"email": "fabian@meumertzhe.im",
"github": "fmeum",
"name": "Fabian Meumertzheim"
}
],
"repository": [
"github:fmeum/buildozer"
],
"versions": [],
"yanked_versions": {}
}
19 changes: 19 additions & 0 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
bcr_test_module:
module_path: tests
matrix:
platform:
- debian10
- ubuntu2004
- macos
- macos_arm64
- windows
tasks:
run_test_module:
name: Run test module
platform: ${{ platform }}
shell_commands:
- bazel run //:run_buildozer
build_targets:
- //...
test_targets:
- //...
5 changes: 5 additions & 0 deletions .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "",
"strip_prefix": "{REPO}-{VERSION}",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz"
}
1 change: 1 addition & 0 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Required by the release workflow
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Based on
# https://github.com/bazel-contrib/rules-template/blob/07fefdbc09d7ca2a49d24220e00dac2efc2bf9b7/.github/workflows/release.yml

# Cut a release whenever a new tag is pushed to the repo.
# You should use an annotated tag, like `git tag -a v1.2.3`
# and put the release notes into the commit message for the tag.
name: Release

on:
push:
tags:
- "v*.*.*"

jobs:
release:
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v5
with:
release_files: buildozer-*.tar.gz
26 changes: 26 additions & 0 deletions .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

# Based on
# https://github.com/bazel-contrib/rules-template/blob/07fefdbc09d7ca2a49d24220e00dac2efc2bf9b7/.github/workflows/release_prep.sh

set -o errexit -o nounset -o pipefail

# Set by GH actions, see
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
TAG=${GITHUB_REF_NAME}
# The prefix is chosen to match what GitHub generates for source archives
PREFIX="buildozer-${TAG:1}"
ARCHIVE="buildozer-$TAG.tar.gz"
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')

cat << EOF
## Using Bzlmod
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\` (default with Bazel 7).
2. Add to your \`MODULE.bazel\` file:
\`\`\`starlark
bazel_dep(name = "buildozer", version = "${TAG:1}")
\`\`\`
EOF
5 changes: 0 additions & 5 deletions release/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@ sh_binary(
name = "update",
srcs = ["update.sh"],
)

sh_binary(
name = "release",
srcs = ["release.sh"],
)
34 changes: 0 additions & 34 deletions release/release.sh

This file was deleted.

0 comments on commit 9d1248d

Please sign in to comment.