Update release.yml #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
jobs: | |
create-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get version | |
id: get-version | |
run: | | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
else | |
node -p "require('./package.json').version" > version.txt | |
echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT | |
fi | |
- name: Create Release | |
if: startsWith(github.ref, 'refs/tags/') != true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
VERSION=$(node -p "require('./package.json').version") | |
gh release create "v$VERSION" --draft --title "v$VERSION" --notes "Release v$VERSION" | |
build: | |
needs: create-release | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Setup pnpm cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install Rust (Stable) | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install Linux dependencies | |
if: matrix.platform == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf \ | |
libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libsoup-3.0-0 webkit2gtk-4.1-dev | |
- name: Install frontend dependencies | |
run: pnpm install | |
- name: Build the app | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tagName: v${{ needs.create-release.outputs.version }} | |
releaseName: "App v${{ needs.create-release.outputs.version }}" | |
releaseBody: "Release v${{ needs.create-release.outputs.version }}" | |
releaseDraft: true | |
prerelease: false |