-
Notifications
You must be signed in to change notification settings - Fork 14
143 lines (122 loc) · 4.04 KB
/
Copy pathrelease-updater.yml
File metadata and controls
143 lines (122 loc) · 4.04 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
name: Release Updater
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build-assets:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-15-intel
target: x86_64-apple-darwin
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Validate tag ref
shell: bash
run: |
if [[ "${GITHUB_REF}" != refs/tags/v* ]]; then
echo "Release Updater must run on a version tag, current ref: ${GITHUB_REF}"
exit 1
fi
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: "10"
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Tauri bundles
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: pnpm tauri build --target ${{ matrix.target }}
- name: Stage release assets
shell: bash
run: |
node .github/scripts/stage-release-assets.js \
"src-tauri/target/${{ matrix.target }}/release/bundle" \
"${{ matrix.target }}" \
"release-assets/${{ matrix.target }}"
- name: Upload staged assets
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: release-assets/${{ matrix.target }}
if-no-files-found: error
publish-release:
runs-on: ubuntu-latest
needs: build-assets
steps:
- uses: actions/checkout@v4
- name: Validate tag ref
shell: bash
run: |
if [[ "${GITHUB_REF}" != refs/tags/v* ]]; then
echo "Release Updater must run on a version tag, current ref: ${GITHUB_REF}"
exit 1
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Download staged assets
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Generate latest.json
run: |
node .github/scripts/build-latest-json.js \
"${{ github.ref_name }}" \
"${{ github.repository }}" \
"artifacts" \
"latest.json"
- name: Ensure release exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
if ! gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
gh release create "${GITHUB_REF_NAME}" --title "Skills Manager ${GITHUB_REF_NAME}" --notes-file ".github/release-notes.md"
fi
- name: Upload release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
mapfile -t files < <(find artifacts -type f | sort)
gh release upload "${GITHUB_REF_NAME}" "${files[@]}" "latest.json" --clobber
- name: Sync release notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
gh release edit "${GITHUB_REF_NAME}" \
--title "Skills Manager ${GITHUB_REF_NAME}" \
--notes-file ".github/release-notes.md"