diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 26299216d..ca6ccf349 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,11 @@ on: jobs: start: runs-on: macos-14 + outputs: + dry_run: ${{ steps.dry_run.outputs.test }} + mas_version: ${{ steps.mas_version.outputs.test }} + release_branch: ${{ steps.release_branch.outputs.test }} + release_commit: ${{ steps.release_commit.outputs.test }} 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 @@ -27,15 +32,21 @@ jobs: echo "release.target_commitish: ${{ github.event.release.target_commitish }}" echo -e "release.body: \n${{ github.event.release.body }}" - echo "DRY_RUN=false" >>$GITHUB_ENV - echo "MAS_VERSION=${{ github.event.release.tag_name }}" >>${GITHUB_ENV} - echo "RELEASE_COMMIT=${{ github.event.release.target_commitish }}" >>${GITHUB_ENV} + - id: dry_run + run: | + echo "DRY_RUN=false + + - id: mas_version + run: | + echo "MAS_VERSION=${{ github.event.release.tag_name }}" >>"$GITHUB_OUTPUT" - - name: ๐Ÿ”ˆ Log environment variables + - id: release_branch run: | - echo "DRY_RUN: ${DRY_RUN}" - echo "MAS_VERSION: ${MAS_VERSION}" - echo "RELEASE_COMMIT: ${RELEASE_COMMIT}" + echo "RELEASE_BRANCH=releases/release-${{ github.event.release.tag_name }}" >>"$GITHUB_OUTPUT" + + - id: release_commit + run: | + echo "RELEASE_COMMIT=${{ github.event.release.target_commitish }}" >>"$GITHUB_OUTPUT" prepare-release: runs-on: macos-14 @@ -47,17 +58,22 @@ jobs: fetch-depth: 0 - name: ๐Ÿ”€ Create release branch + env: + RELEASE_BRANCH: ${{ needs.start.outputs.release_branch }} run: | - branch_name="releases/release-${MAS_VERSION}" - echo "RELEASE_BRANCH=${branch_name}" >>${GITHUB_ENV} - git branch "${branch_name}" - git switch "${branch_name}" + git branch "${RELEASE_BRANCH}" + git switch "${RELEASE_BRANCH}" - name: ๐Ÿ”– Update version + env: + MAS_VERSION: ${{ needs.start.outputs.mas_version }} + RELEASE_COMMIT: ${{ needs.start.outputs.release_commit }} run: | script/version_bump "${MAS_VERSION}" "${RELEASE_COMMIT}" - name: ๐Ÿ’พ Commit changes + env: + MAS_VERSION: ${{ needs.start.outputs.mas_version }} run: | git add \ "Homebrew/mas.rb" \ @@ -69,6 +85,8 @@ jobs: - name: โคด๏ธ Open PR env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAS_VERSION: ${{ needs.start.outputs.mas_version }} + RELEASE_BRANCH: ${{ needs.start.outputs.release_branch }} run: | gh pr create \ --base main \ @@ -78,7 +96,7 @@ jobs: pkg-installer: runs-on: macos-14 - needs: [prepare-release] + needs: [start, prepare-release] steps: - uses: actions/checkout@v4 with: @@ -100,14 +118,17 @@ jobs: script/package - name: ๐Ÿš€ Upload mas.pkg - if: ${{ env.DRY_RUN == 'false' }} + env: + DRY_RUN: ${{ needs.start.outputs.dry_run }} + MAS_VERSION: ${{ needs.start.outputs.mas_version }} + if: ${{ needs.start.outputs.dry_run == 'false' }} run: | gh release upload ${MAS_VERSION} \ .build/mas.pkg homebrew-tap: runs-on: macos-14 - needs: [prepare-release] + needs: [start, prepare-release] steps: - uses: actions/checkout@v4 with: @@ -119,19 +140,25 @@ jobs: script/bootstrap -f - name: ๐Ÿšฐ Update mas tap formula + env: + DRY_RUN: ${{ needs.start.outputs.dry_run }} + MAS_VERSION: ${{ needs.start.outputs.mas_version }} run: | - DRY_RUN=${{ env.DRY_RUN }} \ - script/brew_tap_update ${{ env.MAS_VERSION }} + DRY_RUN=${DRY_RUN} \ + script/brew_tap_update ${MAS_VERSION} - name: ๐Ÿš€ Upload Bottles - if: ${{ env.DRY_RUN == 'false' }} + env: + DRY_RUN: ${{ needs.start.outputs.dry_run }} + MAS_VERSION: ${{ needs.start.outputs.mas_version }} + if: ${{ needs.start.outputs.dry_run == 'false' }} run: | gh release upload ${MAS_VERSION} \ .build/bottles/mas-*.bottle.tar.gz homebrew-core: runs-on: macos-14 - needs: [prepare-release, homebrew-tap] + needs: [start, prepare-release, homebrew-tap] steps: - uses: actions/checkout@v4 with: @@ -143,7 +170,10 @@ jobs: script/bootstrap -f - name: ๐Ÿบ Update Homebrew mas formula + env: + DRY_RUN: ${{ needs.start.outputs.dry_run }} + MAS_VERSION: ${{ needs.start.outputs.mas_version }} run: | - DRY_RUN=${{ env.DRY_RUN }} \ - script/brew_core_update ${{ env.MAS_VERSION }} + DRY_RUN=${DRY_RUN} \ + script/brew_core_update ${MAS_VERSION}