Files
TodoFlow/.github/workflows/release.yml
T
2026-05-31 10:53:40 +02:00

90 lines
2.6 KiB
YAML

name: Release Tauri App
on:
push:
tags:
# Accept lowercase and uppercase tags, for example v1.1.0.0 or V1.1.0.0.
- 'v*'
- 'V*'
workflow_dispatch:
jobs:
release:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './widget/src-tauri -> target'
- name: Install app dependencies
run: |
cd widget
npm install
- name: Update app version from tag
shell: bash
run: |
# Keep Tauri/Cargo on valid SemVer while allowing release tags like V1.1.0.0.
RAW_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^[vV]//')
APP_VERSION="1.1.0"
if [[ "$RAW_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(\.[0-9]+)?$ ]]; then
APP_VERSION="${BASH_REMATCH[1]}"
fi
echo "Updating app version to $APP_VERSION"
node -e "
const fs = require('fs');
const updateJson = (file, update) => {
const data = JSON.parse(fs.readFileSync(file, 'utf8'));
update(data);
fs.writeFileSync(file, JSON.stringify(data, null, 2) + '\n', 'utf8');
};
updateJson('./widget/package.json', (pkg) => {
pkg.version = '$APP_VERSION';
});
updateJson('./widget/src-tauri/tauri.conf.json', (config) => {
config.package.version = '$APP_VERSION';
});
const cargoFile = './widget/src-tauri/Cargo.toml';
const cargo = fs.readFileSync(cargoFile, 'utf8')
.replace(/^version = \".*\"$/m, 'version = \"$APP_VERSION\"');
fs.writeFileSync(cargoFile, cargo, 'utf8');
"
- name: Build the Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: 'TodoFlow ${{ github.ref_name }}'
releaseBody: |
Installeur Windows de TodoFlow ${{ github.ref_name }}.
Telechargez le fichier `.exe` (NSIS) ou `.msi` ci-dessous pour installer l'application.
releaseDraft: false
prerelease: false
projectPath: './widget'