Release #49
Workflow file for this run
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: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: The tag to manually run a deploy for. (example tag `v1.2.3`) | |
required: true | |
prerelease: | |
description: | | |
Is this for a prerelease? | |
(for internal testing, not announced nor published to our brew tap) | |
(example tag `v1.2.3-beta.0`) | |
type: boolean | |
default: false | |
required: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
org-check: | |
name: Check GitHub Organization | |
if: ${{ github.repository_owner == 'pantsbuild' }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Noop | |
run: "true" | |
determine-tag: | |
name: Determine the release tag to operate against. | |
needs: org-check | |
runs-on: ubuntu-22.04 | |
outputs: | |
release-tag: ${{ steps.determine-tag.outputs.release-tag }} | |
release-version: ${{ steps.determine-tag.outputs.release-version }} | |
prerelease: ${{ steps.determine-tag.outputs.prerelease }} | |
steps: | |
- name: Determine Tag | |
id: determine-tag | |
run: | | |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then | |
RELEASE_TAG=${{ github.event.inputs.tag }} | |
PRERELEASE=${{ github.event.inputs.prerelease }} | |
else | |
RELEASE_TAG=${GITHUB_REF#refs/tags/} | |
PRERELEASE=false | |
fi | |
if [[ "${RELEASE_TAG}" =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]] || [[ "${PRERELEASE}" == true ]]; then | |
echo "release-tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT | |
echo "release-version=${RELEASE_TAG#v}" >> $GITHUB_OUTPUT | |
echo "prerelease=${PRERELEASE}" >> $GITHUB_OUTPUT | |
else | |
echo "::error::Release tag '${RELEASE_TAG}' must match 'v\d+.\d+.\d+' when not doing a pre-release." | |
exit 1 | |
fi | |
github-release: | |
name: (${{ matrix.os }}) Create Github Release | |
needs: determine-tag | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-22.04, macOS-10.15-X64, macOS-11-ARM64 ] | |
environment: Release | |
steps: | |
- name: Checkout scie-pants ${{ needs.determine-tag.outputs.release-tag }} | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.determine-tag.outputs.release-tag }} | |
- name: Package scie-pants ${{ needs.determine-tag.outputs.release-tag }} binary | |
if: ${{ matrix.os != 'ubuntu-22.04' }} | |
run: cargo run -p package -- --dest-dir dist/ scie | |
- name: Package scie-pants ${{ needs.determine-tag.outputs.release-tag }} binary | |
if: ${{ matrix.os == 'ubuntu-22.04' }} | |
run: | | |
cargo run -p package -- --dest-dir dist/ tools | |
docker run --rm \ | |
-v $PWD:/code \ | |
-w /code \ | |
rust:1.76.0-alpine3.19 \ | |
sh -c ' | |
apk add cmake make musl-dev perl && \ | |
cargo run -p package -- --dest-dir dist/ scie-pants | |
' | |
cargo run -p package -- --dest-dir dist/ scie \ | |
--scie-pants dist/scie-pants --tools-pex dist/tools.pex | |
- name: Prepare Changelog | |
id: prepare-changelog | |
uses: a-scie/actions/changelog@v1.5 | |
with: | |
changelog-file: ${{ github.workspace }}/CHANGES.md | |
version: ${{ needs.determine-tag.outputs.release-version }} | |
setup-python: ${{ matrix.os == 'ubuntu-22.04' }} | |
- name: Create ${{ needs.determine-tag.outputs.release-tag }} Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.determine-tag.outputs.release-tag }} | |
name: scie-pants ${{ needs.determine-tag.outputs.release-version }} | |
body_path: ${{ steps.prepare-changelog.outputs.changelog-file }} | |
draft: false | |
prerelease: $${{ needs.determine-tag.outputs.prerelease }} | |
files: dist/scie-pants-* | |
fail_on_unmatched_files: true | |
discussion_category_name: Announcements | |
aarch64-release-trigger: | |
name: Trigger Circle CI Linux aarch64 Github Release | |
needs: | |
- determine-tag | |
- github-release | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Trigger aarch64 release | |
uses: CircleCI-Public/trigger-circleci-pipeline-action@v1.0.5 | |
with: | |
GHA_Meta: "${{ needs.determine-tag.outputs.release-tag }}" | |
env: | |
CCI_TOKEN: ${{ secrets.CCI_TOKEN }} | |
announce-release: | |
name: Announce Release | |
needs: | |
- determine-tag | |
- github-release | |
- aarch64-release-trigger | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Post Release Announcement to Pants Slack `#announce` | |
if: ${{ needs.determine-tag.outputs.prerelease != 'true' }} | |
id: slack | |
uses: slackapi/slack-github-action@v1.23.0 | |
with: | |
channel-id: "C18RRR4JK" | |
# N.B.: You can muck with the JSON blob and see the results rendered here: | |
# https://app.slack.com/block-kit-builder | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "The `pants` launcher binary (scie-pants) ${{ needs.determine-tag.outputs.release-tag }} is released:\n* https://github.com/pantsbuild/scie-pants/releases/tag/${{ needs.determine-tag.outputs.release-tag }}\n* https://www.pantsbuild.org/docs/installation" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "_N.B.: The Linux aarch64 release will lag by ~15 minutes._" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
update-homebrew-tap: | |
name: Update pantsbuild/homebrew-tap | |
needs: | |
- determine-tag | |
- github-release | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Bump `scie-pants` version in Casks/pants.rb to ${{ needs.determine-tag.outputs.release-tag }} | |
if: ${{ needs.determine-tag.outputs.prerelease != 'true' }} | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.TAP_TOKEN }} | |
# Docs: https://octokit.github.io/rest.js/v19#actions-create-workflow-dispatch | |
script: | | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: 'pantsbuild', | |
repo: 'homebrew-tap', | |
workflow_id: 'release.yml', | |
ref: 'main', | |
inputs: { | |
tag: '${{ needs.determine-tag.outputs.release-tag }}' | |
} | |
}) |