Skip to content

Commit

Permalink
Tweak release process
Browse files Browse the repository at this point in the history
  • Loading branch information
jvolkman committed Jan 29, 2024
1 parent ada5959 commit 4b115d8
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .bazelignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
env
examples
tests/smoke
tests/smoke_bzlmod
tests/smoke_workspace
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Configuration for 'git archive'
# see https://git-scm.com/docs/git-archive/2.40.0#ATTRIBUTES
# Don't include examples in the distribution artifact, just to reduce size
.github/ export-ignore
examples/ export-ignore
tests/smoke_bzlmod/ export-ignore
tests/smoke_workspace/ export-ignore
28 changes: 11 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,22 @@ jobs:
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 //...
- name: .bazelrc.ci
run: |
python -c "import os; file = open('.bazelrc.ci', 'w'); file.write(os.environ['BAZELRC_CI']); file.close()"
shell: bash
env:
# Bazelisk will download bazel to here
XDG_CACHE_HOME: ~/.cache/bazel-repo

# Don't run the requirements test because the ubuntu runner's python version doesn't necessarily match
# the development host's.
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test -- //... -//pycross/private:requirements_test
- name: Prepare workspace snippet
run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
BAZELRC_CI: ${{secrets.BAZELRC_CI}}
- name: bazel test //...
run: bazel test -- //...
- name: Prepare release
run: .github/workflows/release_prep.sh ${{ env.GITHUB_REF_NAME }} > 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_pycross-*.tar.gz
fail_on_unmatched_files: true
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,33 @@ set -o errexit -o nounset -o pipefail
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
TAG=${GITHUB_REF_NAME}
PREFIX="rules_pycross-${TAG:1}"
ARCHIVE="rules_pycross-$TAG.tar.gz"

# NB: configuration for 'git archive' is in /.gitattributes
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}')

cat << EOF
WORKSPACE snippet:
## Using Bzlmod:
Add to your \`MODULE.bazel\` file:
\`\`\`starlark
bazel_dep(name = "rules_pycross", version = "${TAG:1}")
\`\`\`
## Using \`WORKSPACE\`:
\`\`\`starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_pycross",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/jvolkman/rules_pycross/archive/refs/tags/${TAG}.tar.gz",
url = "https://github.com/jvolkman/rules_pycross/releases/download/${TAG}/${ARCHIVE}",
)
# Fetches the rules_pycross dependencies.
# If you want to have a different version of some dependency,
# you should fetch it *before* calling this.
# Alternatively, you can skip calling this function, so long as you've
# already fetched all the dependencies.
load("@rules_pycross//pycross:repositories.bzl", "rules_pycross_dependencies")
rules_pycross_dependencies()
\`\`\`
EOF
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [0.5.0]

### Added

- (pycross_lock_file) `disallow_builds` - fail if any `pycross_wheel_build` targets would be generated.
Expand Down Expand Up @@ -50,7 +52,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

(No notes - pre-dates this file.)

[unreleased]: https://github.com/jvolkman/rules_pycross/compare/v0.4...HEAD
[unreleased]: https://github.com/jvolkman/rules_pycross/compare/v0.5.0...HEAD
[0.5.0]: https://github.com/jvolkman/rules_pycross/compare/v0.4...v0.5.0
[0.4]: https://github.com/jvolkman/rules_pycross/compare/v0.3...v0.4
[0.3]: https://github.com/jvolkman/rules_pycross/compare/v0.2...v0.3
[0.2]: https://github.com/jvolkman/rules_pycross/compare/0.1...v0.2
Expand Down

0 comments on commit 4b115d8

Please sign in to comment.