From f697098e91ec5f5b9272623f98434df9b615e1b0 Mon Sep 17 00:00:00 2001 From: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> Date: Sun, 17 Nov 2024 05:17:06 -0500 Subject: [PATCH] `release.yml`: improve comments, remove unnecessary environment variables, and reorder some settings. Partial #638 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> --- .github/workflows/release.yml | 22 ++++++++-------------- script/brew_core_update | 6 ------ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 757915a..8683a58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ name: release defaults: run: - # Prefixes all `run` commands with the following command to force them to run outside Rosetta. + # Force all run commands to not use Rosetta 2 shell: arch -arm64 /bin/bash --noprofile --norc -eo pipefail {0} on: release: @@ -18,11 +18,8 @@ jobs: mas_version: ${{ steps.mas_version.outputs.mas_version }} pre_release: ${{ steps.pre_release.outputs.pre_release }} steps: - # Logs event details and sets `DRY_RUN` env var - # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable - # https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=published#release - name: 🔈 Log release event - # This step will only run for a real 'release' event. + # Run only for a real release event if: ${{ github.event.release.name != '' }} run: | echo 'Triggered by a release publication event (wet run)' @@ -49,7 +46,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - # A fetch-depth of 0 includes all history and tags for script/version + # Include all history & tags for script/version fetch-depth: 0 ref: ${{ needs.start.outputs.mas_version }} @@ -57,8 +54,7 @@ jobs: run: | script/bootstrap -f - # Important to trigger a universal build first as package just works with - # the `mas` binary in finds in the build dir. + # Run a universal build to produce mas binary for package - name: 🏗️ Build Universal run: | script/build --universal @@ -68,10 +64,9 @@ jobs: script/package - name: 🚀 Upload mas.pkg + if: ${{ needs.start.outputs.dry_run == 'false' }} env: GH_TOKEN: ${{ github.token }} - DRY_RUN: ${{ needs.start.outputs.dry_run }} - if: ${{ needs.start.outputs.dry_run == 'false' }} run: | gh release upload '${{ needs.start.outputs.mas_version }}' \ .build/mas.pkg @@ -96,13 +91,13 @@ jobs: mas-cli/tap/mas homebrew-core: + if: ${{ needs.start.outputs.pre_release == 'false' }} runs-on: macos-15 needs: [start, homebrew-tap] - if: ${{ needs.start.outputs.pre_release == 'false' }} steps: - uses: actions/checkout@v4 with: - # A fetch-depth of 0 includes all history and tags for script/version + # Include all history & tags for script/version fetch-depth: 0 ref: ${{ needs.start.outputs.mas_version }} @@ -113,6 +108,5 @@ jobs: - name: 🍺 Update homebrew-core mas formula env: HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} - DRY_RUN: ${{ needs.start.outputs.dry_run }} run: | - script/brew_core_update + script/brew_core_update ${{ needs.start.outputs.dry_run }} diff --git a/script/brew_core_update b/script/brew_core_update index 1424eb6..6b1e10b 100755 --- a/script/brew_core_update +++ b/script/brew_core_update @@ -42,12 +42,6 @@ while getopts 'd' o; do done shift "$((OPTIND - 1))" -# DRY_RUN environment variable -# shellcheck disable=SC2153 -if [[ "${DRY_RUN}" == 'true' ]]; then - dry_run=--dry-run -fi - version_tag="v$(script/version)" revision="$(git rev-parse "${version_tag}")"