Skip to content

relase on push to main #11

relase on push to main

relase on push to main #11

Workflow file for this run

name: 'release'
on:
workflow_dispatch:
push:
branches:
- 'main'
jobs:
create-release:
permissions:
contents: write
runs-on: ubuntu-20.04
outputs:
release_id: ${{ steps.create-release.outputs.result }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: Get version
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: Create release
id: create-release
uses: actions/github-script@v6
with:
script: |
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${process.env.PACKAGE_VERSION}`,
name: `v${process.env.PACKAGE_VERSION}`,
body: '*This release was generated automatically using GitHub Actions.*',
draft: true,
prerelease: false
})
return data.id
build-tauri:
needs: create-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: v2 -> v2/target
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache-dependency-path: v2/package-lock.json
- name: Install apt dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt install -y --no-install-recommends libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf
- name: Install windows wix binaries (windows only)
if: matrix.platform == 'windows-latest'
run: |
mkdir temp
cd temp
curl https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip -LO
Expand-Archive ./wix311-binaries.zip -DestinationPath ./WixTools
curl https://github.com/tauri-apps/binary-releases/releases/download/nsis-3/nsis-3.zip -LO
Expand-Archive ./nsis-3.zip -DestinationPath ./NSIS
mv .\NSIS\nsis-3.*\* .\NSIS
rmdir .\NSIS\nsis-3.*
curl https://github.com/tauri-apps/binary-releases/releases/download/nsis-plugins-v0/NSIS-ApplicationID.zip -LO
Expand-Archive .\NSIS-ApplicationID.zip -DestinationPath .\NSIS-ApplicationID
mv .\NSIS-ApplicationID\Release\* .\NSIS\Plugins\x86-unicode
curl https://github.com/tauri-apps/nsis-tauri-utils/releases/download/nsis_tauri_utils-v0.1.1/nsis_tauri_utils.dll -LO
mv .\nsis_tauri_utils.dll .\NSIS\Plugins\x86-unicode
mv .\NSIS ~\AppData\Local\tauri\NSIS
mv .\WixTools ~\AppData\Local\tauri\WixTools
echo "done"
- name: Install pnpm
run: npm install -g pnpm
- name: Install frontend dependencies
run: pnpm install
- name: Build the app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
publish-release:
permissions:
contents: write
runs-on: ubuntu-20.04
needs: [create-release, build-tauri]
steps:
- name: Publish release
id: publish-release
uses: actions/github-script@v6
env:
release_id: ${{ needs.create-release.outputs.release_id }}
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.release_id,
draft: false,
prerelease: false
})