-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started adding a release propecess to our repositority
- Loading branch information
1 parent
43d6c50
commit ad40b32
Showing
3 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Configuration for 'git archive' | ||
# see https://git-scm.com/docs/git-archive/2.40.0#ATTRIBUTES | ||
# Exclude a bunch of paths to save some disk space | ||
e2e export-ignore | ||
.aspect export-ignore | ||
.github export-ignore | ||
dev export-ignore | ||
remap_tar_test export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Prepare release | ||
run: .github/workflows/release_prep.sh > release_notes.txt | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
prerelease: true | ||
# Use GH feature to populate the changelog automatically | ||
generate_release_notes: true | ||
body_path: release_notes.txt | ||
files: | | ||
rules_booking-*.tar.gz | ||
fail_on_unmatched_files: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit -o nounset -o pipefail | ||
set -x | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
# Set by GH actions, see | ||
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables | ||
|
||
# The prefix is chosen to match what GitHub generates for source archives | ||
PREFIX="rules_booking-${GITHUB_REF_NAME}" | ||
ARCHIVE="${PREFIX}.tar.gz" | ||
ARCHIVE_TMP=$(mktemp) | ||
|
||
# NB: configuration for 'git archive' is in /.gitattributes | ||
git archive --format=tar --prefix=${PREFIX}/ --worktree-attributes ${GITHUB_REF_NAME} > $ARCHIVE_TMP | ||
|
||
# we could patch the tar here if we needed binaries | ||
|
||
gzip < $ARCHIVE_TMP > $ARCHIVE | ||
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') | ||
INTEGRITY=$(openssl dgst -sha256 -binary $ARCHIVE | openssl base64 -A | sed 's/^/sha256-/') | ||
|
||
# Set by GH actions, see | ||
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables | ||
REPO_URL="https://github.com/${GITHUB_REPOSITORY:-bookingcom/rules_booking}" | ||
|
||
cat << EOF | ||
## Using [Bzlmod] with Bazel 6: | ||
Add to your \`MODULE.bazel\` file: | ||
\`\`\`starlark | ||
bazel_dep(name = "rules_booking", version = "${GITHUB_REF_NAME:1}") | ||
archive_override( | ||
module_name = "rules_booking", | ||
integrity = "${INTEGRITY}", | ||
strip_prefix = "${PREFIX}", | ||
urls = [ | ||
"${REPO_URL}/releases/download/${GITHUB_REF_NAME}/${ARCHIVE}", | ||
] | ||
) | ||
\`\`\` | ||
[Bzlmod]: https://bazel.build/build/bzlmod | ||
## Using WORKSPACE | ||
\`\`\`starlark | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
http_archive( | ||
name = "rules_booking", | ||
sha256 = "${SHA}", | ||
strip_prefix = "${PREFIX}", | ||
url = "${REPO_URL}/releases/download/${GITHUB_REF_NAME}/${ARCHIVE}", | ||
) | ||
load( | ||
"@rules_booking//:repositories.bzl", | ||
rules_booking_repositories = "repositories", | ||
) | ||
rules_booking_repositories() | ||
load( | ||
"@rules_booking//:dependencies.bzl", | ||
rules_booking_dependencies = "dependencies", | ||
) | ||
rules_booking_dependencies() | ||
\`\`\` | ||
EOF |