Skip to content

Commit

Permalink
Switch from tags to branches for releases
Browse files Browse the repository at this point in the history
  • Loading branch information
bpcreech committed May 18, 2024
1 parent 3a4bb4a commit b50b85d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 21 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
pull_request: {}
# For releases:
push:
tags:
- v*
branches:
- 'release/*'

concurrency:
group: build-${{ github.head_ref }}
Expand Down Expand Up @@ -68,8 +68,8 @@ jobs:
# releases.
# For more info on this GitHub Actions hack, see:
# https://stackoverflow.com/questions/65384420/how-do-i-make-a-github-action-matrix-element-conditional#answer-73822998
- image: ${{ !startsWith(github.ref, 'refs/tags') && 'arm64v8/debian:bullseye' }}
- image: ${{ !startsWith(github.ref, 'refs/tags') && 'arm64v8/alpine:3.19' }}
- image: ${{ !startsWith(github.ref, 'refs/heads/release/') && 'arm64v8/debian:bullseye' }}
- image: ${{ !startsWith(github.ref, 'refs/heads/release/') && 'arm64v8/alpine:3.19' }}

steps:
- name: Configure git
Expand All @@ -83,7 +83,7 @@ jobs:
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
# For security reasons, only use sccache on releases:
if: ${{ startsWith(github.ref, 'refs/tags') }}
if: ${{ startsWith(github.ref, 'refs/heads/release/') }}

- uses: uraimo/run-on-arch-action@v2
name: Build wheel
Expand Down Expand Up @@ -323,7 +323,7 @@ jobs:
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
# For security reasons, only use sccache on releases:
if: ${{ startsWith(github.ref, 'refs/tags') }}
if: ${{ startsWith(github.ref, 'refs/heads/release') }}

- uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -351,24 +351,35 @@ jobs:
release:
name: Create GitHub release
if: startsWith(github.ref, 'refs/tags')
if: startsWith(github.ref, 'refs/heads/release')
needs:
- linux-wheels
- non-linux-wheels
# TODO add back
# - linux-wheels
# - non-linux-wheels
- sdist
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v3

- name: Compute release version
run: |
VERSION=${GITHUB_REF_NAME#release/}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Make release
uses: ncipollo/release-action@v1
with:
artifacts: "wheels/*,sdist/*"
commit: ${{ github.ref }}
tag: ${{ env.VERSION }}

publish:
name: Upload release to PyPI
if: startsWith(github.ref, 'refs/tags')
# TODO swap back
if: false
# if: startsWith(github.ref, 'refs/heads/release')
needs:
- release
runs-on: ubuntu-latest
Expand Down
29 changes: 18 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,26 +186,33 @@ repository.
To release:
1. Merge all changes into `main` on the offical repository.
1. Update `HISTORY.md` with a summary of changes since the last release.
1. Merge all changes into `main` on the official repository.
1. Pick the next revision number:
```sh
$ git fetch --tags
$ git tag -l
# observe the next available tag
$ git fetch
$ git ls-remote origin | grep refs/heads/release
# observe the next available release version
```
1. Update `src/py_mini_racer/__about__.py` with the new revision number.
1. Create a `feature/...` branch, and:
1. Update `HISTORY.md` with a summary of changes since the last release.
1. Update `src/py_mini_racer/__about__.py` with the new revision number.
1. Create and merge a pull request for this branch into `main`.
1. Add and push a tag:
1. Create a `release/...` branch:
```sh
NEXT_TAG=the next tag
$ git tag "${NEXT_TAG}"
$ git push origin "${NEXT_TAG}"
$ git checkout main
$ git pull
$ git checkout -b release/
NEXT_RELEASE=the next tag, starting with the letter v. E.g., "v0.12.1".
$ git checkout -b "release/${NEXT_RELEASE}"
$ git push --set-upstream origin "release/${NEXT_RELEASE}"
```
1. Observe the build process on GitHub Actions. It should build and push docs and upload
Expand Down

0 comments on commit b50b85d

Please sign in to comment.