-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (136 loc) · 5.49 KB
/
Copy pathrelease.yml
File metadata and controls
161 lines (136 loc) · 5.49 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
name: 'Release'
on:
workflow_dispatch: # Allow manual triggering
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper versioning
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: latest
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Build the app
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 }}
with:
tagName: v__VERSION__ # Will replace __VERSION__ with the app version
releaseName: 'DRNKN Notes v__VERSION__'
# The release body will be generated from the tag message and/or CHANGELOG.md if it exists
# If neither is available, it will use this generic template
releaseBody: |
Release notes for DRNKN Notes v__VERSION__
For detailed changes, please see the commit history.
releaseDraft: true
prerelease: false
includeUpdaterJson: true
args: ${{ matrix.args }}
update-latest-json:
needs: publish-tauri
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: latest
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install dependencies
run: pnpm add -g @tauri-apps/cli@next
- name: Download and prepare update files
run: |
mkdir -p public
VERSION=$(node -e "console.log(require('./package.json').version)")
echo "App version: $VERSION"
# Create updater endpoints directory structure
mkdir -p public/update
# Download latest.json file from the release
gh release download "v$VERSION" -p "*latest*.json" -D ./public/update/ --clobber || true
# List what was downloaded
echo "Downloaded files:"
find ./public/update -type f -name "*.json" -ls
# Validate and process the latest.json file
if [ $(find ./public/update -name "*latest*.json" | wc -l) -eq 1 ]; then
echo "Found latest.json file, validating format..."
LATEST_JSON=$(find ./public/update -name "*latest*.json" | head -n 1)
# Validate JSON structure
if ! jq . "$LATEST_JSON" > /dev/null 2>&1; then
echo "Error: Invalid JSON format in $LATEST_JSON"
exit 1
fi
# Ensure the file has the required fields for Tauri v2
if ! jq -e '.version and .platforms' "$LATEST_JSON" > /dev/null 2>&1; then
echo "Error: latest.json is missing required fields (version and/or platforms)"
exit 1
fi
# Verify the platform entries
echo "Verifying platform entries in latest.json..."
PLATFORMS=$(jq -r '.platforms | keys[]' "$LATEST_JSON")
for platform in $PLATFORMS; do
echo "✓ Found platform: $platform"
# Verify URL and signature exist for each platform
if ! jq -e ".platforms[\"$platform\"].url and .platforms[\"$platform\"].signature" "$LATEST_JSON" > /dev/null 2>&1; then
echo "Warning: Platform $platform is missing required URL or signature field"
fi
done
else
echo "No latest.json file found or multiple files found. Please ensure a single latest.json file is included in the release."
exit 1
fi
# Final verification
echo "Final updater file:"
find ./public/update -type f -name "*.json" -ls
# Display content summary
echo "Content summary of latest.json:"
jq '{version, notes, platforms: (.platforms | keys)}' ./public/update/latest.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy updater endpoint
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: updater
force_orphan: true