-
-
Notifications
You must be signed in to change notification settings - Fork 171
127 lines (125 loc) · 4.61 KB
/
build-preview.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
# documentation: https://github.com/deltachat/sysadmin/tree/master/download.delta.chat
name: Preview Builds
on:
pull_request:
paths-ignore:
- 'docs/**' # only trigger build if a file outside of /docs was changed
- 'README_ASSETS/**'
- 'test/**'
- '*.md'
- '.prettierrc.yml'
- '.vscode/**'
jobs:
upload-preview:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
name: Upload Preview
steps:
# Preperation
- uses: actions/checkout@v1
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Get Pullrequest ID
id: prepare
run: |
node -e "console.log('::set-output name=prid::' + '${{ github.ref }}'.split('/')[2])"
- name: change build name and Product Name to development id
run: |
node ./bin/github-actions/devbuild.js
# Building JS
- name: pnpm install, build
run: |
npm i -g pnpm
pnpm install --frozen-lockfile
cd packages/target-electron
pnpm build
pnpm run pack:generate_config
pnpm run pack:patch-node-modules
# Packaging and processing
- name: LINUX electron builder
if: runner.os == 'Linux'
run: |
export DEBUG=electron-builder
cd packages/target-electron
pnpm electron-builder --publish never --linux AppImage
- name: LINUX renaming / upload Preperation
if: runner.os == 'Linux'
working-directory: packages/target-electron
run: |
cd dist
mkdir preview
mv *.AppImage preview/deltachat-desktop-${{ steps.prepare.outputs.prid }}.AppImage
ls preview
cd ..
- name: MAC electron builder
if: runner.os == 'macOS'
run: |
cd packages/target-electron
echo "module.exports=()=>Promise.resolve()" > stub.cjs
export CSC_IDENTITY_AUTO_DISCOVERY=false
export DEBUG=electron-builder
pnpm i dmg-license
# all archs are enabled, because only installing some is not supported yet by pnpm: https://github.com/pnpm/pnpm/issues/7510
# pnpm i --cpu x64 --os darwin
# pnpm i --cpu arm64 --os darwin
ls node_modules/@deltachat
pnpm electron-builder --publish never --mac mas dmg -c.mac.identity=null --universal --config.afterSign="stub.cjs"
- name: MAC renaming / upload Preperation
if: runner.os == 'macOS'
working-directory: packages/target-electron
run: |
ls -lah dist
mkdir -p dist/preview
zip -r dist/preview/deltachat-desktop-mas-${{ steps.prepare.outputs.prid }}.zip dist/mas-universal
cd dist
mv *.dmg preview/deltachat-desktop-${{ steps.prepare.outputs.prid }}.dmg || true
cd ..
ls dist/preview
- name: WINDOWS electron builder
if: runner.os == 'Windows'
run: |
cd packages/target-electron
set DEBUG=electron-builder
pnpm electron-builder --win portable --config.artifactName="deltachat-desktop-${{ steps.prepare.outputs.prid }}.portable.exe"
- name: WINDOWS renaming / upload Preperation
if: runner.os == 'Windows'
working-directory: packages/target-electron/dist
run: |
dir
mkdir preview
move Delta*Chat*.exe preview/deltachat-desktop-${{ steps.prepare.outputs.prid }}.portable.exe
dir preview
cd ..
# Upload Step
- name: upload folder
id: upload
shell: bash
run: |
echo -e "${{ secrets.KEY }}" >__TEMP_INPUT_KEY_FILE
chmod 600 __TEMP_INPUT_KEY_FILE
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r packages/target-electron/dist/preview/* "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/desktop/preview/"
continue-on-error: true
- name: "Post links to details"
if: steps.upload.outcome == 'success'
run: node ./bin/github-actions/postLinksToDetails.js
env:
PR_ID: ${{ steps.prepare.outputs.prid }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload result to artifacts
id: upload-github
if: steps.upload.outcome == 'failure'
uses: actions/upload-artifact@main
with:
name: ${{ matrix.os }} output
path: packages/target-electron/dist/preview/
- name: "Post links to GitHub artifact to details"
if: steps.upload-github.outcome == 'success'
run: node ./bin/github-actions/postLinksToDetails.js
env:
FULL_ARTIFACT_URL: ${{ steps.upload-github.outputs.artifact-url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}