Skip to content

Build & Release Tauri app #58

Build & Release Tauri app

Build & Release Tauri app #58

Workflow file for this run

name: 'Build & Release Tauri app'
on:
workflow_dispatch:
inputs:
release_message:
description: 'Message to write in the release'
required: true
type: string
default: '[Changelog](https://github.com/UnofficialCrusaderPatch/UCP3-GUI/wiki/Changelog#)'
pre_release:
description: 'Pre release?'
required: true
default: true
type: boolean
env:
RELEASE_BODY: ''
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- name: Checkout git repo
uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 16
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: install app dependencies
run: |
npm ci
- name: Create changelog URL
run: |
$m = "${{ inputs.release_message }}"
$t = "[Changelog](https://github.com/UnofficialCrusaderPatch/UCP3-GUI/wiki/Changelog#)"
if ( $m.Contains($t) ) {
Install-Module -Name PSToml -Scope CurrentUser -Force
Import-Module PSToml
## Get the version
$conf = Get-Content -Raw -Path "src-tauri/Cargo.toml" | ConvertFrom-Toml
$v = $conf.package.version
$vm = $v.Replace(".", "") # Needed this way for pound urls
## Create the version URL
$url = $t.Replace("#", "#v$vm")
$n = $m.Replace($t, $url)
## Write the url
echo "RELEASE_BODY=$n" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} else {
echo "RELEASE_BODY=$m" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
shell: pwsh
- name: Build the app and publish it
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
includeRelease: true
includeUpdaterJson: true
updaterJsonPreferNsis: true
tagName: v__VERSION__
releaseName: 'UCP3-GUI: v__VERSION__'
releaseBody: '${{ env.RELEASE_BODY }}'
releaseDraft: false
prerelease: ${{ inputs.pre_release }}
# TODO: include owner and repo to push to the main UCP repo
- name: Push release to auto updater
if: ${{ inputs.pre_release == false }}
uses: exuanbo/actions-deploy-gist@v1
with:
token: '${{ secrets.UCP3_MACHINE_GIST_TOKEN }}'
gist_id: 2a179c892f49448c85dfcc9e5f9a3c6b
file_path: latest.json
file_type: text
# - name: create latest.json
# shell: pwsh
# run: |
# $json = Get-Content .\src-tauri\tauri.conf.json | ConvertFrom-Json
# $version = $json.package.version
# $latest = @{
# 'version' = $version
# 'notes' = "Latest Tauri build"
# 'pub_date' = Get-Date -Format "o"
# 'platforms' = @{
# 'windows-x86_64' = @{
# 'signature' = ''
# 'url' = '' # Don't know how to solve this with a private repo
# }
# }
# }
# ConvertTo-Json $latest | Set-Content -Path latest.json
# - uses: 'marvinpinto/action-automatic-releases@latest'
# with:
# repo_token: '${{ secrets.GITHUB_TOKEN }}'
# automatic_release_tag: 'latest'
# prerelease: true
# draft: false
# title: 'Tauri Development Build'
# files: |
# latest.json
# src-tauri/target/release/*.exe
# src-tauri/target/release/*.zip
# src-tauri/target/release/*.sig
# src-tauri/target/release/bundle/msi/*.msi
# src-tauri/target/release/bundle/msi/*.zip
# src-tauri/target/release/bundle/msi/*.sig
# src-tauri/target/release/bundle/nsis/*.nsis
# src-tauri/target/release/bundle/nsis/*.zip
# src-tauri/target/release/bundle/nsis/*.sig