-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a release workflow to GitHub Actions (#257)
- Loading branch information
1 parent
fcfabcf
commit 7dcdddd
Showing
4 changed files
with
171 additions
and
34 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,74 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: "The version to release (e.g., '20240414')." | ||
type: string | ||
sha: | ||
description: "The full SHA of the commit to be released (e.g., 'd09ff921d92d6da8d8a608eaa850dc8c0f638194')." | ||
type: string | ||
dry-run: | ||
description: "Whether to run the release process without actually releasing." | ||
default: false | ||
required: false | ||
type: boolean | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
release: | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: extractions/setup-just@v2 | ||
|
||
# Perform a release in dry-run mode. | ||
- run: just release-dry-run ${{ secrets.GITHUB_TOKEN }} ${{ github.event.inputs.sha }} ${{ github.event.inputs.tag }} | ||
if: ${{ github.event.inputs.dry-run == 'true' }} | ||
|
||
# Create the release itself. | ||
- name: Configure Git identity | ||
if: ${{ github.event.inputs.dry-run == 'false' }} | ||
run: | | ||
git config --global user.name "$GITHUB_ACTOR" | ||
git config --global user.email "[email protected]" | ||
# Fetch the commit so that it exists locally. | ||
- name: Fetch commit | ||
if: ${{ github.event.inputs.dry-run == 'false' }} | ||
run: git fetch origin ${{ github.event.inputs.sha }} | ||
|
||
# Associate the commit with the tag. | ||
- name: Create tag | ||
if: ${{ github.event.inputs.dry-run == 'false' }} | ||
run: git tag ${{ github.event.inputs.tag }} ${{ github.event.inputs.sha }} | ||
|
||
# Push the tag to GitHub. | ||
- name: Push tag | ||
if: ${{ github.event.inputs.dry-run == 'false' }} | ||
run: git push origin ${{ github.event.inputs.tag }} | ||
|
||
# Create a GitHub release. | ||
- name: Create GitHub Release | ||
if: ${{ github.event.inputs.dry-run == 'false' }} | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ github.event.inputs.tag }} | ||
name: ${{ github.event.inputs.tag }} | ||
prerelease: true | ||
body: TBD | ||
allowUpdates: true | ||
updateOnlyUnreleased: true | ||
|
||
# Uploading the relevant artifact to the GitHub release. | ||
- run: just release-run ${{ secrets.GITHUB_TOKEN }} ${{ github.event.inputs.sha }} ${{ github.event.inputs.tag }} | ||
if: ${{ github.event.inputs.dry-run == 'false' }} |
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,27 @@ | ||
============ | ||
Contributing | ||
============ | ||
|
||
Releases | ||
======== | ||
|
||
To cut a release, wait for the "MacOS Python build", "Linux Python build", and | ||
"Windows Python build" GitHub Actions to complete successfully on the target commit. | ||
|
||
Then, run the "Release" GitHub Action to create the release, populate the release artifacts (by | ||
downloading the artifacts from each workflow, and uploading them to the GitHub Release), and promote | ||
the SHA via the `latest-release` branch. | ||
|
||
The "Release" GitHub Action takes, as input, a tag (assumed to be a date in `YYYYMMDD` format) and | ||
the commit SHA referenced above. | ||
|
||
For example, to create a release on April 19, 2024 at commit `29abc56`, run the "Release" workflow | ||
with the tag `20240419` and the commit SHA `29abc56954fbf5ea812f7fbc3e42d87787d46825` as inputs, | ||
once the "MacOS Python build", "Linux Python build", and "Windows Python build" workflows have | ||
run to completion on `29abc56`. | ||
|
||
When the "Release" workflow is complete, populate the release notes in the GitHub UI and promote | ||
the pre-release to a full release, again in the GitHub UI. | ||
|
||
At any stage, you can run the "Release" workflow in dry-run mode to avoid uploading artifacts to | ||
GitHub. Dry-run mode can be executed before or after creating the release itself. |
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