Skip to content

Nightly Release

Nightly Release #96

name: Nightly Release
on:
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: "0 18 * * *"
permissions:
contents: write
concurrency:
group: nightly-release
cancel-in-progress: false
jobs:
build-windows:
name: Build Windows nightly
runs-on: windows-latest
defaults:
run:
working-directory: react-vite
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: react-vite/package-lock.json
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: react-vite/src-tauri
- name: Install frontend dependencies
run: npm ci
- name: Build Tauri bundles
run: npx tauri build
- name: Prepare nightly artifacts
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist-nightly | Out-Null
$msi = Get-ChildItem -Path "src-tauri/target/release/bundle/msi" -Filter "*.msi" | Select-Object -First 1
$nsis = Get-ChildItem -Path "src-tauri/target/release/bundle/nsis" -Filter "*.exe" | Select-Object -First 1
if (-not $msi) { throw "MSI artifact not found" }
if (-not $nsis) { throw "NSIS artifact not found" }
Copy-Item $msi.FullName "dist-nightly/Codex-Switcher-nightly-windows-x64.msi"
Copy-Item $nsis.FullName "dist-nightly/Codex-Switcher-nightly-windows-x64-setup.exe"
@"
# Codex Switcher Nightly
This prerelease is generated automatically from `main`.
- Commit: $env:GITHUB_SHA
- Branch: $env:GITHUB_REF_NAME
- Run: $env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID
Nightly builds are for testing only. Stable releases are published manually.
"@ | Set-Content -Path "dist-nightly/nightly-notes.md" -Encoding UTF8
- name: Publish nightly release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view nightly *> $null
if ($LASTEXITCODE -eq 0) {
gh release delete nightly --yes --cleanup-tag
}
git tag -f nightly $env:GITHUB_SHA
git push origin nightly --force
gh release create nightly `
"dist-nightly/Codex-Switcher-nightly-windows-x64.msi" `
"dist-nightly/Codex-Switcher-nightly-windows-x64-setup.exe" `
--title "Nightly Build" `
--notes-file "dist-nightly/nightly-notes.md" `
--prerelease `
--latest=false