Skip to content

release

release #34

Workflow file for this run

#
# .github/workflows/release.yml
#
---
name: release
defaults:
run:
# Prefixes all `run` commands with the following command to force them to run outside Rosetta.
shell: arch -arm64 bash --noprofile --norc -eo pipefail {0}
on:
release:
types: [published]
jobs:
start:
runs-on: macos-14
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.
if: ${{ github.event.release.name != '' }}
run: |
echo "Triggered by a release publication event (wet run)"
echo "release.name: ${{ github.event.release.name }}"
echo "release.tag_name: ${{ github.event.release.tag_name }}"
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}
- name: πŸ”ˆ Log environment variables
run: |
echo "DRY_RUN: ${DRY_RUN}"
echo "MAS_VERSION: ${MAS_VERSION}"
echo "RELEASE_COMMIT: ${RELEASE_COMMIT}"
version-update:
runs-on: macos-14
needs: [start]
steps:
- uses: actions/checkout@v4
with:
# A fetch-depth of 0 includes all history and tags for script/version
fetch-depth: 0
- name: πŸ”– version
run: |
script/version_bump "${MAS_VERSION}" "${RELEASE_COMMIT}"
# branch_name="releases/release-${MAS_VERSION}"
# $echo git branch "${branch_name}"
# $echo git switch "${branch_name}"
# $echo git add \
# "${SWIFT_PACKAGE}" \
# "${LOCAL_MAS_FORMULA_PATH}" \
# "${LOCAL_TAP_FORMULA_PATH}"
# $echo git commit --message="πŸ”– Version ${MAS_VERSION}"
pkg-installer:
runs-on: macos-14
needs: [version-update]
steps:
- uses: actions/checkout@v4
with:
# A fetch-depth of 0 includes all history and tags for script/version
fetch-depth: 0
- name: πŸ‘’ Bootstrap
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.
- name: πŸ—οΈ Build Universal
run: |
script/build --universal
- name: πŸ“¦ macOS Package
run: |
script/package
- name: πŸš€ Upload mas.pkg
if: ${{ env.DRY_RUN == 'false' }}
run: |
gh release upload ${MAS_VERSION} \
.build/mas.pkg
homebrew-tap:
runs-on: macos-14
needs: [version-update]
steps:
- uses: actions/checkout@v4
with:
# A fetch-depth of 0 includes all history and tags for script/version
fetch-depth: 0
- name: πŸ‘’ Bootstrap
run: |
script/bootstrap -f
- name: 🚰 Update mas tap formula
run: |
DRY_RUN=${{ env.DRY_RUN }} \
script/brew_tap_update ${{ env.MAS_VERSION }}
- name: πŸš€ Upload Bottles
if: ${{ env.DRY_RUN == 'false' }}
run: |
gh release upload ${MAS_VERSION} \
.build/bottles/mas-*.bottle.tar.gz
homebrew-core:
runs-on: macos-14
needs: [version-update, homebrew-tap]
steps:
- uses: actions/checkout@v4
with:
# A fetch-depth of 0 includes all history and tags for script/version
fetch-depth: 0
- name: πŸ‘’ Bootstrap
run: |
script/bootstrap -f
- name: 🍺 Update Homebrew mas formula
run: |
DRY_RUN=${{ env.DRY_RUN }} \
script/brew_core_update ${{ env.MAS_VERSION }}