-
Notifications
You must be signed in to change notification settings - Fork 284
222 lines (192 loc) · 7.37 KB
/
build.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Release
on:
push:
tags:
- v*
permissions:
contents: 'write'
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-13
- ubuntu-latest
- windows-latest
steps:
- name: Setup
run: |
git config --global url."https://${{secrets.USER}}:${{secrets.TOKEN}}@github.com/".insteadOf "https://github.com/"
git config --global url."https://${{secrets.USER}}:${{secrets.TOKEN}}@api.github.com/".insteadOf "https://api.github.com/"
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.22
- name: Setup GO
run: |
go version
echo GOPATH=$(go env GOPATH) >> $GITHUB_ENV
echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
echo $(go env GOPATH)/bin >> $GITHUB_PATH
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install LibSecret
if: matrix.os == 'ubuntu-latest'
run:
sudo apt-get install libsecret-1-dev
- name: Install AzureSignTool
if: matrix.os == 'windows-latest'
run: dotnet tool install --global AzureSignTool
- name: Check out Git repository
uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 20.9.0
- name: Install Webpack
run: npm install --save-dev webpack-cli --legacy-peer-deps
- name: Update locale
run: npm run update:locale
env:
GITHUB_TOKEN: ${{secrets.TOKEN}}
#- name: Update Deps
# run: npm run build:deps
- name: Update Addon Windows
if: matrix.os == 'windows-latest'
shell: bash
run: ./update-ci.sh ${{secrets.USER}} ${{secrets.TOKEN}} ${{matrix.os}}
- name: Update Addon
if: matrix.os != 'windows-latest'
shell: bash
run: |
./update-ci.sh ${{secrets.USER}} ${{secrets.TOKEN}} ${{matrix.os}} arm
./update-ci.sh ${{secrets.USER}} ${{secrets.TOKEN}} ${{matrix.os}} amd
- name: Build Native Messaging Host Windows
if: matrix.os == 'windows-latest'
run: npm run build:nmh-win
env:
CGO_ENABLED: 0
- name: Build Native Messaging Host
if: matrix.os != 'windows-latest'
run: npm run build:nmh
env:
CGO_ENABLED: 0
- name: Build Front Mac OS
if: matrix.os == 'macos-13'
uses: samuelmeuli/action-electron-builder@v1
with:
github_token: ${{secrets.TOKEN}}
mac_certs: ${{ secrets.MAC_CERT_TEXT }}
mac_certs_password: ${{ secrets.MAC_CERT_PASS }}
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
args: --arm64 --x64
env:
DEBUG: electron-builder
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
APPLETEAM: ${{ secrets.APPLETEAM }}
DO_KEY_ID: ${{ secrets.DO_KEY_ID }}
DO_SECRET_KEY: ${{ secrets.DO_SECRET_KEY }}
USE_HARD_LINKS: false
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
- name: Build Front Other
if: matrix.os != 'macos-13'
uses: samuelmeuli/action-electron-builder@v1
with:
github_token: ${{secrets.TOKEN}}
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
env:
DEBUG: electron-builder
DO_KEY_ID: ${{ secrets.DO_KEY_ID }}
DO_SECRET_KEY: ${{ secrets.DO_SECRET_KEY }}
USE_HARD_LINKS: false
AZURE_KEY_VAULT_URI: ${{ secrets.AZURE_KEY_VAULT_URI }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_CERT_NAME: ${{ secrets.AZURE_CERT_NAME }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
- name: Make artifacts dir
run: |
mkdir -p artifacts
- name: Cleanup artifacts
if: matrix.os != 'windows-latest'
run: |
mv dist/*.{zip,dmg,deb,AppImage,exe,snap,rpm,tar.gz} artifacts || true
- name: Cleanup artifacts Windows
if: matrix.os == 'windows-latest'
run: |
rm dist/anytypeHelper.exe
rm dist/nativeMessagingHost.exe
mv dist/*.exe artifacts
- name: Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
files: "artifacts/**"
env:
GITHUB_TOKEN: ${{secrets.TOKEN}}
- name: debug
if: matrix.os != 'windows-latest'
run: |
echo "list dist/:"
ls -alh dist/
echo "list artifacts/:"
ls -alh artifacts/
- name: debug Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Get-ChildItem -Path dist | Format-Table -Property Mode, LastWriteTime, Length, Name
Get-ChildItem -Path artifacts | Format-Table -Property Mode, LastWriteTime, Length, Name
- name: Upload artifacts to HTTP server
if: matrix.os != 'windows-latest'
run: |
RELEASE_VERSION=$( echo "$GITHUB_REF_NAME" | perl -pe 's/^[a-zA-Z]+//' )
cd artifacts/
for FILE in *; do
UPLOAD_URL="https://publish-releases.anytype.io/desktop/upload/${RELEASE_VERSION}/${FILE}"
echo "Uploading files to ${UPLOAD_URL}"
curl \
--header "Authorization: Bearer ${{ secrets.PUBLISH_RELEASES_TOKEN }}" \
--upload-file ${FILE} \
${UPLOAD_URL}
done
cd ../dist/
for FILE in *.yml; do
UPLOAD_URL="https://publish-releases.anytype.io/desktop/upload/${RELEASE_VERSION}/${FILE}"
echo "Uploading files to ${UPLOAD_URL}"
curl \
--header "Authorization: Bearer ${{ secrets.PUBLISH_RELEASES_TOKEN }}" \
--upload-file ${FILE} \
${UPLOAD_URL}
done
- name: Upload artifacts to HTTP server Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$releaseVersion = $env:GITHUB_REF_NAME -replace '^[a-zA-Z]+', ''
$files = Get-ChildItem -File artifacts
foreach ($file in $files) {
$encodedFileName = [System.Uri]::EscapeDataString($file.Name)
$uploadUrl = "https://publish-releases.anytype.io/desktop/upload/$releaseVersion/$encodedFileName"
echo "Uploading files to $uploadUrl"
curl.exe -H "Authorization: Bearer ${{ secrets.PUBLISH_RELEASES_TOKEN }}" -T $file.FullName $uploadUrl
}
$yml_files = Get-ChildItem -File dist -Filter *.yml
foreach ($file in $yml_files) {
$encodedFileName = [System.Uri]::EscapeDataString($file.Name)
$uploadUrl = "https://publish-releases.anytype.io/desktop/upload/$releaseVersion/$encodedFileName"
echo "Uploading files to $uploadUrl"
curl.exe -H "Authorization: Bearer ${{ secrets.PUBLISH_RELEASES_TOKEN }}" -T $file.FullName $uploadUrl
}
- name: Delete old releases
uses: dev-drprasad/[email protected]
with:
keep_latest: 3
delete_tag_pattern: alpha
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}