-
-
Notifications
You must be signed in to change notification settings - Fork 22
119 lines (102 loc) · 3.82 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Release
on:
push:
branches:
- "!*"
tags:
- '[0-9].[0-9]+.[0-9]+'
jobs:
sign-pack-upload:
runs-on: macos-12
steps:
- uses: actions/checkout@v2
with:
submodules: true
# get copy of Mail.app since it's missing from the GitHub Actions runner images
- name: checkout Mail.app
uses: actions/checkout@v2
with:
repository: apparition47/Mail.app
path: mail-app
- uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- name: build and package
run: |
make unsigntool
xcodebuild \
-project MailTrackerBlocker.xcodeproj \
-target MailTrackerBlocker \
BUNDLE_LOADER=mail-app/14.0/Mail.app/Contents/MacOS/Mail \
build
make pack
- name: notarize and staple
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
AC_TEAMID: CW298N32P4
run: |
xcrun notarytool submit build/Release/MailTrackerBlocker.pkg \
--apple-id "$AC_USERNAME" \
--team-id "$AC_TEAMID" \
--password "$AC_PASSWORD" \
--wait
xcrun stapler staple build/Release/MailTrackerBlocker.pkg
- name: generate release log
run: |
CURRENT_TAG=${GITHUB_REF#refs/tags/}
awk -v ver=$CURRENT_TAG '
/^#+ \[/ { if (p) { exit }; if ($2 == "["ver"]") { p=1; next} } p && NF
' CHANGELOG.md > build/releaselog.md
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }} Release
body_path: ./build/releaselog.md
draft: false
prerelease: false
- name: upload release asset pkg
id: upload-pkg
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/Release/MailTrackerBlocker.pkg
asset_name: MailTrackerBlocker.pkg
asset_content_type: application/x-newton-compatible-pkg
- name: Checkout private Homebrew tap
uses: actions/checkout@v2
with:
repository: apparition47/homebrew-tap
path: apparition47-homebrew-tap
token: ${{ secrets.REPO_PAT }} # repo scope
- name: Branch name
id: branch_name
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Update cask in Homebrew tap
run: |
CASK_NAME=mailtrackerblocker
CASK_VERSION=${{ steps.branch_name.outputs.SOURCE_TAG }}
CASK_SHA256=$(shasum --algorithm 256 "build/Release/MailTrackerBlocker.pkg" | awk '{print $1}')
brew update
brew bump-cask-pr --no-browse --sha256 ${CASK_SHA256} --version ${CASK_VERSION} --no-audit --no-style ${CASK_NAME}
cd apparition47-homebrew-tap
git config --local user.name "${USER_NAME}"
git config --local user.email "${USER_NAME}@users.noreply.github.com"
sed -i '' "s/\( *version *\"\)\([^\"]*\)\"/\1${CASK_VERSION}\"/" Casks/${CASK_NAME}.rb
sed -i '' "s/\( *sha256 *\"\)\([^\"]*\)\"/\1${CASK_SHA256}\"/" Casks/${CASK_NAME}.rb
git add Casks/${CASK_NAME}.rb
git commit -m "update ${CASK_NAME} to v${CASK_VERSION}"
git push origin
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} # repo:public_repo, workflow scope
USER_NAME: ${{ github.event.sender.login }}