-
Notifications
You must be signed in to change notification settings - Fork 28
165 lines (146 loc) · 5.34 KB
/
nightly.yml
File metadata and controls
165 lines (146 loc) · 5.34 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
165
name: Nightly Build
# Daily / on-demand builds, published as a rolling pre-release on GitHub.
#
# Difference vs release.yml:
# - release.yml → triggered by `v*` semver tags, becomes the "Latest" stable release
# - nightly.yml → continuous interim builds, marked prerelease, single rolling tag
#
# Trigger options:
# - Manual: Actions tab → "Nightly Build" → Run workflow
# - Push to main: every commit (disabled by default; uncomment the push block)
# - Daily cron at 04:00 UTC
on:
workflow_dispatch:
schedule:
- cron: '0 4 * * *'
# Uncomment to also build on every push to main:
# push:
# branches: [main]
permissions:
contents: write
concurrency:
group: nightly-build
cancel-in-progress: true
jobs:
prepare-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
release_id: ${{ steps.recreate.outputs.release_id }}
steps:
- uses: actions/checkout@v6
- name: Compute nightly version + tag
id: version
shell: bash
run: |
BASE_VERSION=$(node -p "require('./open-pdf-studio/package.json').version")
DATE=$(date -u +'%Y%m%d')
SHORT_SHA=$(git rev-parse --short HEAD)
VERSION="${BASE_VERSION}-nightly.${DATE}.${SHORT_SHA}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "tag=nightly" >> "$GITHUB_OUTPUT"
echo "Building nightly ${VERSION}"
- name: Delete previous nightly release + tag (rolling)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete nightly --yes --cleanup-tag || true
- name: Create fresh nightly release (prerelease, draft=false so artifacts upload visibly)
id: recreate
uses: actions/github-script@v7
with:
script: |
const version = "${{ steps.version.outputs.version }}";
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: "nightly",
target_commitish: context.sha,
name: `Nightly build ${version}`,
body: [
"🌙 **Nightly / interim build** — not a stable release.",
"",
"Built from the latest `main` branch. May contain bugs or incomplete features.",
"For stable, use the latest `v*` release.",
"",
`Source: \`${context.sha.substring(0,7)}\``,
`Build version: \`${version}\``
].join("\n"),
draft: false,
prerelease: true
});
core.setOutput("release_id", data.id);
return data.id;
build-tauri:
needs: prepare-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'ubuntu-22.04'
args: ''
target: 'linux'
- platform: 'macos-latest'
args: '--target universal-apple-darwin'
target: 'macos'
- platform: 'windows-latest'
args: ''
target: 'windows-system'
- platform: 'windows-latest'
args: ''
target: 'windows-user'
runs-on: ${{ matrix.platform }}
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: 'tauri2026'
defaults:
run:
working-directory: open-pdf-studio
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install Rust targets (macOS universal)
if: matrix.target == 'macos'
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
- name: Install dependencies (Ubuntu only)
if: matrix.target == '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: Set user install mode (Windows user installer)
if: matrix.target == 'windows-user'
shell: pwsh
run: |
$conf = Get-Content src-tauri/tauri.conf.json -Raw | ConvertFrom-Json
$conf.bundle.windows.nsis.installMode = "currentUser"
$conf | ConvertTo-Json -Depth 10 | Set-Content src-tauri/tauri.conf.json
- name: Build Tauri app
if: matrix.target != 'windows-user'
uses: tauri-apps/tauri-action@action-v0.6.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: open-pdf-studio
args: ${{ matrix.args }}
releaseId: ${{ needs.prepare-release.outputs.release_id }}
includeUpdaterJson: false
- name: Build Tauri app (Windows user installer)
if: matrix.target == 'windows-user'
uses: tauri-apps/tauri-action@action-v0.6.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: open-pdf-studio
args: ${{ matrix.args }}
releaseId: ${{ needs.prepare-release.outputs.release_id }}
includeUpdaterJson: false