Release #3
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
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' }} |