-
Notifications
You must be signed in to change notification settings - Fork 85
162 lines (136 loc) · 6.59 KB
/
build.yaml
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
name: Builds
on:
push:
branches:
- master
- ci/*
- release/*
pull_request:
branches:
- master
jobs:
build:
name: Build ${{ matrix.os }}
strategy:
matrix:
os: ['windows-latest', 'macos-latest', 'ubuntu-latest']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Auth GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_ARTIFACTS_KEY }}
# on Windows GCP Actions needs path to Python, see https://github.com/GoogleCloudPlatform/github-actions/issues/100
- name: Setup GCP (Windows)
uses: google-github-actions/setup-gcloud@v1
env:
CLOUDSDK_PYTHON: ${{env.pythonLocation}}\python.exe
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
if: runner.os == 'Windows'
- name: Setup GCP (non Windows)
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
if: runner.os != 'Windows'
- name: Update apt index (Linux)
run: sudo apt update
if: runner.os == 'Linux'
- name: Install system libs (Linux)
run: sudo apt install libcurl4 libudev-dev libusb-1.0-0-dev xvfb
if: runner.os == 'Linux'
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Enable Corepack
run: corepack enable
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install dependencies
run: yarn install
- name: Get commit data (Windows)
id: commit-data-windows
run: |
echo "commit-date=$(git show -s --format=%cs ${{ github.sha }})" >> $env:GITHUB_OUTPUT
echo "short-sha=$(git rev-parse --short ${{ github.sha }})" >> $env:GITHUB_OUTPUT
if: runner.os == 'Windows'
- name: Get commit data (non Windows)
id: commit-data-non-windows
run: |
echo "commit-date=$(git show -s --format=%cs ${{ github.sha }})" >> "$GITHUB_OUTPUT"
echo "short-sha=$(git rev-parse --short ${{ github.sha }})" >> "$GITHUB_OUTPUT"
if: runner.os != 'Windows'
- name: Write commit data (Windows)
run: |
echo '{' > packages/desktop/commit-data.json
echo ' "commitDate": "${{ steps.commit-data-windows.outputs.commit-date }}",' >> packages/desktop/commit-data.json
echo ' "shortSha": "${{ steps.commit-data-windows.outputs.short-sha }}"' >> packages/desktop/commit-data.json
echo '}' >> packages/desktop/commit-data.json
if: runner.os == 'Windows'
- name: Write commit data (non Windows)
run: |
echo '{' > packages/desktop/commit-data.json
echo ' "commitDate": "${{ steps.commit-data-non-windows.outputs.commit-date }}",' >> packages/desktop/commit-data.json
echo ' "shortSha": "${{ steps.commit-data-non-windows.outputs.short-sha }}"' >> packages/desktop/commit-data.json
echo '}' >> packages/desktop/commit-data.json
if: runner.os != 'Windows'
- name: Get package data (Windows)
id: package-data-windows
run: echo "version=$(jq -r '.version' packages/desktop/package.json)" >> $env:GITHUB_OUTPUT
if: runner.os == 'Windows'
- name: Get package data (non Windows)
id: package-data-non-windows
run: echo "version=$(jq -r '.version' packages/desktop/package.json)" >> "$GITHUB_OUTPUT"
if: runner.os != 'Windows'
- name: Build (Windows)
run: yarn build:dist
env:
APP_VERSION_GIT_TAG: '${{ steps.package-data-windows.outputs.version }}-${{ steps.commit-data-windows.outputs.commit-date }}-${{ steps.commit-data-windows.outputs.short-sha }}'
if: runner.os == 'Windows'
- name: Build (non Windows)
run: yarn build:dist
env:
APP_VERSION_GIT_TAG: '${{ steps.package-data-non-windows.outputs.version }}-${{ steps.commit-data-non-windows.outputs.commit-date }}-${{ steps.commit-data-non-windows.outputs.short-sha }}'
if: runner.os != 'Windows'
# on Windows GCP Actions needs path to Python, see https://github.com/GoogleCloudPlatform/github-actions/issues/100
- name: Upload to GCP (Windows)
run: gsutil cp -n packages/desktop/dist/EmeraldWallet-*.exe gs://artifacts.emerald.cash/builds/emerald-wallet/v${{ steps.package-data-windows.outputs.version }}/
if: runner.os == 'Windows'
env:
CLOUDSDK_PYTHON: ${{env.pythonLocation}}\python.exe
- name: Upload to GCP (non Windows)
run: gsutil cp -n packages/desktop/dist/EmeraldWallet-*.* gs://artifacts.emerald.cash/builds/emerald-wallet/v${{ steps.package-data-non-windows.outputs.version }}/
if: runner.os != 'Windows'
- name: Link to published artifact (Windows)
if: runner.os == 'Windows'
run: echo "https://artifacts.emerald.cash/builds/emerald-wallet/v${{ steps.package-data-windows.outputs.version }}/EmeraldWallet-win-x64-${{ steps.package-data-windows.outputs.version }}-${{ steps.commit-data-windows.outputs.commit-date }}-${{ steps.commit-data-windows.outputs.short-sha }}.exe"
- name: Link to published artifact (macOS)
if: runner.os == 'macOS'
run: echo "https://artifacts.emerald.cash/builds/emerald-wallet/v${{ steps.package-data-non-windows.outputs.version }}/EmeraldWallet-mac-x64-${{ steps.package-data-non-windows.outputs.version }}-${{ steps.commit-data-non-windows.outputs.commit-date }}-${{ steps.commit-data-non-windows.outputs.short-sha }}.dmg"
- name: Link to published artifact (Linux)
if: runner.os == 'Linux'
run: echo "https://artifacts.emerald.cash/builds/emerald-wallet/v${{ steps.package-data-non-windows.outputs.version }}/EmeraldWallet-linux-amd64-${{ steps.package-data-non-windows.outputs.version }}-${{ steps.commit-data-non-windows.outputs.commit-date }}-${{ steps.commit-data-non-windows.outputs.short-sha }}.deb"
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: |
packages/desktop/dist/*.zip
packages/desktop/dist/*.dmg
packages/desktop/dist/*.exe
packages/desktop/dist/*.deb
packages/desktop/dist/*.tar.gz
packages/desktop/dist/*.AppImage