Skip to content

Commit 88ec960

Browse files
authored
add tagged release workflow using github actions (#1452)
* first pass at setting up a release workflow * narrow test command * make workspace_snippet.sh executable * set cache options explicitly on test scope * fix cache path quoting actions/cache#878
1 parent 15f2461 commit 88ec960

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Cut a release whenever a new tag is pushed to the repo.
2+
# You should use an annotated tag, like `git tag -a v1.2.3`.
3+
name: Release
4+
5+
on:
6+
push:
7+
tags:
8+
- 'v*.*.*'
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Prepare workspace snippet
18+
run: .github/workflows/workspace_snippet.sh > release_notes.txt
19+
20+
- name: Release
21+
uses: softprops/action-gh-release@v1
22+
with:
23+
# Use GH feature to populate the changelog automatically
24+
generate_release_notes: true
25+
body_path: release_notes.txt
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit -o nounset -o pipefail
4+
5+
# Set by GH actions, see
6+
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
7+
TAG=${GITHUB_REF_NAME}
8+
PREFIX="rules_scala-${TAG:1}"
9+
SHA=$(git archive --format=tar --prefix="${PREFIX}/" "${TAG}" | gzip | shasum -a 256 | awk '{print $1}')
10+
11+
cat << EOF
12+
## Using WORKSPACE
13+
14+
Paste this snippet into your \`WORKSPACE\` file:
15+
16+
\`\`\`starlark
17+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
18+
19+
http_archive(
20+
name = "rules_scala",
21+
sha256 = "${SHA}",
22+
strip_prefix = "${PREFIX}",
23+
url = "https://github.com/bazelbuild/rules_scala/archive/refs/tags/${TAG}.tar.gz",
24+
)
25+
\`\`\`
26+
27+
See https://github.com/bazelbuild/rules_scala#getting-started for full setup instructions.
28+
EOF

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ http_archive(
4646
url = "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version),
4747
)
4848

49+
# See https://github.com/bazelbuild/rules_scala/releases for up to date version information.
4950
rules_scala_version = "c711b4d1f0d1cc386c63ef748c9df14d2f3a187e"
5051
http_archive(
5152
name = "io_bazel_rules_scala",

0 commit comments

Comments
 (0)