-
Notifications
You must be signed in to change notification settings - Fork 269
90 lines (83 loc) · 3.27 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#
# .github/workflows/release.yml
#
---
name: release
on:
# The `push` event is used only for testing while making changes to this workflow.
# This will be detected by the `github.event.release.name` being empty which
# switches the logic into "dry run" mode.
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push
push:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
release:
types: [published]
jobs:
release:
runs-on: macos-14
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}
env:
DRY_RUN: true
# Dry run version pinned to real release for testing brew build system
MAS_VERSION: v1.8.7-beta.1
RELEASE_COMMIT: f8be3e9aaa6c78490277976f17041f2577f5dc21
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
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 "release.body: ${{ github.event.release.body }}"
echo "DRY_RUN=false" >>$GITHUB_ENV
echo "MAS_VERSION=${{ github.event.release.tag_name }}" >>${GITHUB_REF}
echo "RELEASE_COMMIT=${{ github.event.release.target_commitish }}" >>${GITHUB_REF}
- name: 🔈 Log environment variables
run: |
echo "DRY_RUN: ${DRY_RUN}"
echo "MAS_VERSION: ${MAS_VERSION}"
echo "RELEASE_COMMIT: ${RELEASE_COMMIT}"
- 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
# 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
uses: actions/upload-artifact@v3
if: ${{ env.DRY_RUN == 'false' }}
with:
if-no-files-found: error
name: mas.pkg
path: .build/mas.pkg
- name: 🍺 Update Homebrew mas formula
run: |
DRY_RUN=${{ env.DRY_RUN }} \
script/brew_formula_update ${{ env.MAS_VERSION }}
- name: 🍼 Homebrew Bottles for mas tap
run: |
script/bottle
- name: 🚀 Upload Bottles
uses: actions/upload-artifact@v3
if: ${{ env.DRY_RUN == 'false' }}
with:
if-no-files-found: error
name: homebrew-bottles
path: |
.build/bottles/mas-*.bottle.tar.gz