-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate releases just by pushing a tag (#55)
This comes from the bazel-contrib/rules-template
- Loading branch information
Showing
9 changed files
with
82 additions
and
102 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,37 @@ | ||
# 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: | ||
- "*.*.*" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Mount bazel caches | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
"~/.cache/bazel" | ||
"~/.cache/bazel-repo" | ||
key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }} | ||
restore-keys: bazel-cache- | ||
- name: bazel test //... | ||
env: | ||
# Bazelisk will download bazel to here | ||
XDG_CACHE_HOME: ~/.cache/bazel-repo | ||
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //... | ||
- name: Prepare workspace snippet | ||
run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
# Use GH feature to populate the changelog automatically | ||
generate_release_notes: true | ||
body_path: release_notes.txt |
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,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
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} | ||
PREFIX="bazel-mypy-integration-${TAG}" | ||
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}') | ||
|
||
cat << EOF | ||
WORKSPACE snippet: | ||
\`\`\`starlark | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
http_archive( | ||
name = "mypy_integration", | ||
sha256 = "${SHA}", | ||
strip_prefix = "${PREFIX}", | ||
url = "https://github.com/thundergolfer/bazel-mypy-integration/archive/refs/tags/${TAG}.tar.gz", | ||
) | ||
load( | ||
"@mypy_integration//repositories:repositories.bzl", | ||
mypy_integration_repositories = "repositories", | ||
) | ||
mypy_integration_repositories() | ||
load("@mypy_integration//:config.bzl", "mypy_configuration") | ||
# Optionally pass a MyPy config file, otherwise pass no argument. | ||
mypy_configuration("//tools/typing:mypy.ini") | ||
load("@mypy_integration//repositories:deps.bzl", mypy_integration_deps = "deps") | ||
mypy_integration_deps( | ||
mypy_requirements_file="//tools/typing:mypy_version.txt", | ||
# python_interpreter = "python3.9" # $PATH is searched for exe. | ||
# OR | ||
# python_interpreter_target = "@python3_interpreter//:bin/python3", | ||
) | ||
\`\`\` | ||
EOF |
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
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
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
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
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 |
---|---|---|
@@ -1,5 +0,0 @@ | ||
filegroup( | ||
name = "distribution", | ||
srcs = glob(["**"]), | ||
visibility = ["//:__pkg__"], | ||
) | ||
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 |
---|---|---|
@@ -1,7 +1 @@ | ||
exports_files(["mypy.sh.tpl"]) | ||
|
||
filegroup( | ||
name = "distribution", | ||
srcs = glob(["**"]), | ||
visibility = ["//:__pkg__"], | ||
) |
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 |
---|---|---|
@@ -1,7 +1 @@ | ||
exports_files(["mypy.sh.tpl"]) | ||
|
||
filegroup( | ||
name = "distribution", | ||
srcs = glob(["**"]), | ||
visibility = ["//:__pkg__"], | ||
) |