-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (127 loc) Β· 5.26 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Release Send!
on:
push:
tags:
- "*"
env:
MACOS_APP_NAME: "Send"
MACOS_APP_ARTIFACT: "Send.app"
MACOS_DMG_ARTIFACT: "Send.dmg"
MACOS_ZIP_ARTIFACT: "Send.zip"
XCBUILD_PATH: "build/Build/Products/Release"
CODE_SIGN_IDENTITY: "Apple Development: [email protected] (JLHQ66WC7C)"
jobs:
ReleaseCI:
runs-on: macos-13
steps:
- name: Checkout π
uses: actions/checkout@v4
- name: Manage Version πΌ
run: |
git fetch --prune --unshallow --tags
GIT_SHA="$(git rev-parse --short HEAD)"
CUR_TAG="$(git tag -l | tail -1)"
VER_BUILD="$(xcodebuild -showBuildSettings | grep CURRENT_PROJECT_VERSION | tr -d 'CURRENT_PROJECT_VERSION =')"
VER="$(xcodebuild -showBuildSettings | grep MARKETING_VERSION | tr -d 'MARKETING_VERSION =')"
echo "VER=$VER" >> $GITHUB_ENV
echo "VER_BUILD=$VER_BUILD" >> $GITHUB_ENV
echo "SHORT_SHA=$GIT_SHA" >> $GITHUB_ENV
echo "CUR_TAG=$CUR_TAG" >> $GITHUB_ENV
if [[ -z $CUR_TAG ]]; then
echo "OLD_PRE_TAG=NULL" >> $GITHUB_ENV
else
echo "OLD_PRE_TAG=$CUR_TAG">> $GITHUB_ENV
fi
- name: Install Dependencies π
run: brew install create-dmg
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_AUTO_UPDATE: 1
- name: Install latest stable Rust toolchain π¦
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: 'aarch64-apple-darwin,x86_64-apple-darwin'
- name: Setup latest Xcode βοΈ
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest
- name: Import Certificates π
uses: apple-actions/import-codesign-certs@v2
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- name: Release Build π¨
run: |
xcodebuild -scheme ${MACOS_APP_NAME} -configuration Release -derivedDataPath build -disableAutomaticPackageResolution CODE_SIGN_IDENTITY="${CODE_SIGN_IDENTITY}" | xcpretty && exit ${PIPESTATUS[0]}
- name: Resign app π (Temp fix for Sparkle updating)
run: codesign -f -s "${CODE_SIGN_IDENTITY}" "${XCBUILD_PATH}/${MACOS_APP_ARTIFACT}"
- name: Check Send signature π
run: codesign --verify -vvvv --deep --strict "${XCBUILD_PATH}/${MACOS_APP_ARTIFACT}"
- name: Create Disk Image πΏ
run: |
cp ./dmg/dmg-background.tiff $XCBUILD_PATH
cp ./dmg/VolumeIcon.icns $XCBUILD_PATH
cd $XCBUILD_PATH
create-dmg \
--volname ${MACOS_APP_NAME} \
--volicon "VolumeIcon.icns" \
--background "dmg-background.tiff" \
--window-pos 200 120 \
--window-size 660 420 \
--text-size 12 \
--icon-size 160 \
--icon ${MACOS_APP_ARTIFACT} 180 170 \
--hide-extension ${MACOS_APP_ARTIFACT} \
--app-drop-link 480 170 \
${MACOS_DMG_ARTIFACT} \
${MACOS_APP_ARTIFACT}
cd -
mkdir Artifacts
cp -R ${XCBUILD_PATH}/*.dmg Artifacts
cd $XCBUILD_PATH
zip -r ${MACOS_ZIP_ARTIFACT} ${MACOS_APP_ARTIFACT}
cd -
cp ${XCBUILD_PATH}/*.zip Artifacts
- name: Generate Sparkle Appcast β¨
run: |
RELEASE_URL='https://github.com/EETagent/Send/releases/tag/'
TAG_RELEASE_URL="${RELEASE_URL}${CUR_TAG}"
SPARKLE_BIN='./build/SourcePackages/artifacts/Sparkle/bin'
PUBDATE="$(date +"%a, %d %b %Y %T %z")"
APPCAST=(
'<?xml version="1.0" standalone="yes"?>'
'<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" version="2.0">'
' <channel>'
' <title>Send</title>'
' <item>'
" <title>${VER}</title>"
" <pubDate>${PUBDATE}</pubDate>"
' <description><![CDATA['
' <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Primer/20.4.6/primer.min.css"><meta charset="UTF-8"><div class="markdown-body"><h3>The latest updates are available here:</h3><ul>'
"<a href=\"${TAG_RELEASE_URL}\">${TAG_RELEASE_URL}</a>"
' </ul></div>'
' ]]>'
' </description>'
' <sparkle:minimumSystemVersion>10.13</sparkle:minimumSystemVersion>'
" <enclosure url=\"https://github.com/EETagent/Send/releases/latest/download/Send.dmg\" sparkle:version=\"${VER_BUILD}\" sparkle:shortVersionString=\"${VER}\" type=\"application/octet-stream\" $($SPARKLE_BIN/sign_update -s ${SPARKLE_KEY} ./Artifacts/Send.dmg)/>"
' </item>'
' </channel>'
'</rss>'
)
for appcast in "${APPCAST[@]}"; do
echo "${appcast}" >> ./Artifacts/appcast.xml
done
shell: zsh {0}
env:
SPARKLE_KEY: ${{ secrets.SPARKLE_KEY }}
- name: Publish GitHub Release π
uses: ncipollo/release-action@v1
with:
allowUpdates: true
replacesArtifacts: true
draft: true
prerelease: ${{ env.IS_PRE }}
artifacts: "./Artifacts/*"
tag: ${{ env.REL_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}