-
Notifications
You must be signed in to change notification settings - Fork 1
164 lines (142 loc) · 5.77 KB
/
Copy pathrelease.yml
File metadata and controls
164 lines (142 loc) · 5.77 KB
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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
publish-tauri:
name: Build and Publish ${{ matrix.name }} Bundles
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux AppImage
platform: ubuntu-22.04
assetCode: linux-x64
rustTarget: ""
args: ""
- name: Windows NSIS
platform: windows-latest
assetCode: win-x64
rustTarget: ""
args: ""
- name: macOS Apple Silicon
platform: macos-latest
assetCode: mac-arm64
rustTarget: aarch64-apple-darwin
args: --target aarch64-apple-darwin
- name: macOS Intel
platform: macos-latest
assetCode: mac-x64
rustTarget: x86_64-apple-darwin
args: --target x86_64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Resolve release channel
shell: bash
run: |
echo "TAURI_RELEASE_ARGS=--config src-tauri/tauri.release.conf.json" >> "$GITHUB_ENV"
if [[ "${GITHUB_REF_NAME}" == *-* ]]; then
echo "WORKFLOWSTUDIO_CHANNEL=preview" >> "$GITHUB_ENV"
echo "TAURI_CHANNEL_ARGS=--config src-tauri/tauri.preview.conf.json" >> "$GITHUB_ENV"
echo "RELEASE_CHANNEL_LABEL=Preview" >> "$GITHUB_ENV"
echo "RELEASE_BODY=Preview channel build for WorkFlowStudio. Use this release to validate upcoming changes before they graduate to stable. Updater manifest: updater/preview/latest.json." >> "$GITHUB_ENV"
else
echo "WORKFLOWSTUDIO_CHANNEL=stable" >> "$GITHUB_ENV"
echo "TAURI_CHANNEL_ARGS=" >> "$GITHUB_ENV"
echo "RELEASE_CHANNEL_LABEL=Stable" >> "$GITHUB_ENV"
echo "RELEASE_BODY=Stable channel release for WorkFlowStudio. This is the production-ready updater source. Updater manifest: updater/stable/latest.json." >> "$GITHUB_ENV"
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Add Rust target
if: ${{ matrix.rustTarget != '' }}
run: rustup target add ${{ matrix.rustTarget }}
- name: Cache Rust build outputs
uses: swatinem/rust-cache@v2
with:
workspaces: ./src-tauri -> target
- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: npm install
- name: Build and upload release assets
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
WORKFLOWSTUDIO_CHANNEL: ${{ env.WORKFLOWSTUDIO_CHANNEL }}
with:
projectPath: .
tagName: ${{ github.ref_name }}
releaseName: WorkFlowStudio ${{ env.RELEASE_CHANNEL_LABEL }} ${{ github.ref_name }}
releaseBody: ${{ env.RELEASE_BODY }}
assetNamePattern: '[name]_${{ github.ref_name }}_${{ matrix.assetCode }}[setup][ext]'
generateReleaseNotes: true
prerelease: ${{ contains(github.ref_name, '-') }}
uploadUpdaterJson: true
uploadUpdaterSignatures: true
args: ${{ matrix.args }} ${{ env.TAURI_RELEASE_ARGS }} ${{ env.TAURI_CHANNEL_ARGS }}
publish-updater-manifest:
name: Publish Updater Manifest
runs-on: ubuntu-22.04
needs: publish-tauri
if: ${{ always() && needs.publish-tauri.result != 'cancelled' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Resolve release channel
shell: bash
run: |
if [[ "${GITHUB_REF_NAME}" == *-* ]]; then
echo "RELEASE_CHANNEL=preview" >> "$GITHUB_ENV"
else
echo "RELEASE_CHANNEL=stable" >> "$GITHUB_ENV"
fi
- name: Download updater manifest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p .artifacts/updater
gh release download "${GITHUB_REF_NAME}" \
--repo "${GITHUB_REPOSITORY}" \
--pattern latest.json \
--dir .artifacts/updater
test -f .artifacts/updater/latest.json
- name: Publish channel manifest branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin updater:refs/remotes/origin/updater || true
if git show-ref --verify --quiet refs/remotes/origin/updater; then
git switch --create updater --track origin/updater
else
git switch --orphan updater
git rm -rf . >/dev/null 2>&1 || true
fi
mkdir -p "${RELEASE_CHANNEL}"
cp .artifacts/updater/latest.json "${RELEASE_CHANNEL}/latest.json"
git add "${RELEASE_CHANNEL}/latest.json"
if git diff --cached --quiet; then
echo "No updater manifest changes to publish."
exit 0
fi
git commit -m "chore: update ${RELEASE_CHANNEL} updater manifest for ${GITHUB_REF_NAME}"
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" updater:updater