-
Notifications
You must be signed in to change notification settings - Fork 24
202 lines (181 loc) · 7.66 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
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
---
name: Release
'on':
push:
paths-ignore:
- '**/*.md'
# tags:
# - 'v[0-9]+.[0-9]+.[0-9]+'
branches:
- 'release'
- 'beta'
- 'build-*'
schedule:
- cron: "05 00 * * *"
workflow_dispatch:
concurrency:
# https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/main' || github.ref != 'refs/heads/release' }}
permissions: {}
jobs:
builds:
name: Building ${{ matrix.platform }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'ubuntu-20.04'
args: ''
- platform: 'windows-2019'
args: '--bundles msi,updater'
- platform: 'macos-latest'
args: '--target universal-apple-darwin'
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set environment variables for release
if: ${{ startsWith(github.ref, 'refs/heads/release') }}
shell: bash
run: |
echo "tagName=v__VERSION__" >> $GITHUB_ENV
echo "releaseName=Tari Universe v__VERSION__" >> $GITHUB_ENV
#echo "releaseId=" >> $GITHUB_ENV
echo "TARI_NETWORK=nextnet" >> $GITHUB_ENV
echo "TARI_TARGET_NETWORK=nextnet" >> $GITHUB_ENV
- name: beta builds - Install dependencies (windows) [yq]
if: ${{ ( startsWith(runner.os,'Windows') ) && ( ! startsWith(github.ref, 'refs/heads/release') ) }}
run: |
choco upgrade yq -y
- name: beta builds - Install dependencies (linux) [yq]
if: ${{ ( startsWith(runner.os,'Linux') ) && ( ! startsWith(github.ref, 'refs/heads/release') ) }}
shell: bash
run: |
sudo bash ./scripts/check-get-yq.sh
- name: Set environment variables for beta builds
if: ${{ ( github.event_name == 'schedule' ) || ( ! startsWith(github.ref, 'refs/heads/release') ) }}
env:
BETA_STRING: "-beta"
shell: bash
run: |
#set -xueo pipefail
echo "TARI_NETWORK=esme" >> $GITHUB_ENV
echo "TARI_TARGET_NETWORK=testnet" >> $GITHUB_ENV
#export BETA_DATE=$(date +%Y-%m-%d)
# numeric-only and cannot be greater than 65535 for msi target
export BETA_DATE=4$(date +%m%d)
cd "${GITHUB_WORKSPACE}/src-tauri"
echo "releaseName=Tari Universe${{ env.BETA_STRING }} v__VERSION__-${BETA_DATE}" >> $GITHUB_ENV
# Don't mess with the double quotes and inner escaped quotes
yq eval ".package.productName += \"${{ env.BETA_STRING }}\"" -i tauri.conf.json
yq eval ".package.version += \"-${BETA_DATE}\"" -i tauri.conf.json
sed -i.bak -E "s/^version\s*=\s*\"([0-9]+\.[0-9]+\.[0-9]+)\"/version = \"\1-${BETA_DATE}\"/" \
Cargo.toml
- name: Node.js setup
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
- name: Rust setup (linux)
if: startsWith(runner.os,'Linux')
uses: dtolnay/rust-toolchain@stable
env:
RUSTUP_PERMIT_COPY_RENAME: true
with:
toolchain: stable
target: aarch64-unknown-linux-gnu
- name: Rust setup (macOS)
if: startsWith(runner.os,'macOS')
uses: dtolnay/rust-toolchain@stable
with:
target: aarch64-apple-darwin,x86_64-apple-darwin
- name: Cache cargo files and outputs
if: ${{ ( ! startsWith(github.ref, 'refs/heads/release') ) && ( ! startsWith(github.ref, 'refs/tags/v') ) }}
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install dependencies (linux)
if: startsWith(runner.os,'Linux')
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --assume-yes \
libwebkit2gtk-4.0-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libprotobuf-dev \
protobuf-compiler
- name: Install dependencies (macOS)
if: startsWith(runner.os,'macOS')
run: |
# openssl, cmake and autoconf already installed
brew install zip coreutils automake protobuf libtool
# force install rust OSX multi-arch components
cd src-tauri
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
rustup toolchain install stable-x86_64-apple-darwin --force-non-host
rustup toolchain install stable-aarch64-apple-darwin --force-non-host
- name: Install dependencies (windows)
if: startsWith(runner.os,'Windows')
run: |
vcpkg.exe install sqlite3:x64-windows zlib:x64-windows
choco upgrade protoc -y
- name: Set environment variables (windows)
if: startsWith(runner.os,'Windows')
shell: bash
run: |
echo "SQLITE3_LIB_DIR=C:\vcpkg\installed\x64-windows\lib" >> $GITHUB_ENV
- name: Azure code-signing setup (windows only)
if: ${{ ( startsWith(runner.os,'Windows') ) && ( env.AZURE_TENANT_ID != '' ) }}
shell: bash
env:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
WINDOWS_SIGN_COMMAND: trusted-signing-cli -e https://eus.codesigning.azure.net/ -a Tari -c Tarilabs %1
run: |
cd "${GITHUB_WORKSPACE}/src-tauri"
echo "{}" | \
jq '.tauri .bundle .windows += {"signCommand": "${{ env.WINDOWS_SIGN_COMMAND }}"}' > \
./tauri.windows.conf.json
cat ./tauri.windows.conf.json
cargo install trusted-signing-cli
- name: Install dependencies (node)
run: |
npm --version
npm install
- name: Build Tauri apps
id: build
uses: tauri-apps/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE || secrets.AZURE_TENANT_ID }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
AZURE_TENANT_ID: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_CLIENT_SECRET }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
with:
tagName: ${{ env.tagName }}
releaseName: ${{ env.releaseName }}
releaseBody: 'Tari Universe - See the assets to download this version and install'
# releaseId: ${{ env.releaseId }}
releaseDraft: true
prerelease: true
includeDebug: false
includeRelease: true
args: ${{ matrix.args }}
- name: Upload none releases
if: ${{ ( github.event_name == 'schedule' ) || ( ! startsWith(github.ref, 'refs/heads/release') ) }}
uses: actions/upload-artifact@v4
with:
name: tari-universe_${{ steps.build.outputs.appVersion }}_${{ matrix.platform }}
path: "${{ join(fromJSON(steps.build.outputs.artifactPaths), '\n') }}"