Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Sep 30, 2024
1 parent 1de92f7 commit 09b9708
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release
on:
push:
tags:
- "v*.*.*"

jobs:
release:
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v6
permissions:
contents: write
with:
release_files: rules_gz-*.tar.gz
prerelease: false
27 changes: 27 additions & 0 deletions .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

# invoked by release workflow
# (via https://github.com/bazel-contrib/.github/blob/master/.github/workflows/release_ruleset.yaml)

set -o errexit -o nounset -o pipefail

RULES_NAME="rules_gz"
TAG="${GITHUB_REF_NAME}"
PREFIX="${RULES_NAME}-${TAG:1}"
ARCHIVE="${RULES_NAME}-${TAG:1}.tar.gz"

# embed version in MODULE.bazel
perl -pi -e "s/version = \"0\.0\.0\",/version = \"${TAG:1}\",/g" MODULE.bazel

stash_name=`git stash create`;
git archive --format=tar --prefix=${PREFIX}/ "${stash_name}" | gzip > $ARCHIVE

SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')

cat << EOF
Add to your \`MODULE.bazel\` file:
\`\`\`starlark
bazel_dep(name = "${RULES_NAME}", version = "${TAG:1}")
\`\`\`
EOF

0 comments on commit 09b9708

Please sign in to comment.