Skip to content

Workflow file for this run

name: Release Workflow
on:
push:
tags:
- '*.*.*'
jobs:
release:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Extract tag name
id: variables
run: echo "version=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
shell: bash
- name: Update package.version in tauri.conf.json
run: |
$json = Get-Content -Path "src-tauri\tauri.conf.json" -Raw | ConvertFrom-Json
$json.package.version = "${{ steps.variables.outputs.version }}"
$json | ConvertTo-Json -Depth 100 | Set-Content -Path "src-tauri\tauri.conf.json"
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/setup-node@v3
- name: Install dependencies and build
env:
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
run: |
npm i
npm run tauri build
- uses: ncipollo/release-action@v1
with:
artifacts: .\src-tauri\target\release\bundle\msi\Launcherg_${{ steps.variables.outputs.version }}_x64_ja-JP.msi.zip
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
- name: Update .tauri-updater.json
run: |
$env:TEMP_SIGNATURE = Get-Content -Path ".\src-tauri\target\release\bundle\msi\Launcherg_${{ steps.variables.outputs.version }}_x64_ja-JP.msi.zip.sig"
$data = @{
version = "${{ steps.variables.outputs.version }}"
notes = "See the assets to download this version and install."
pub_date = (Get-Date -Format s) + "Z"
signature = $env:TEMP_SIGNATURE
url = "https://github.com/ryoha000/launcherg/releases/download/${{ steps.variables.outputs.version }}/Launcherg_${{ steps.variables.outputs.version }}_x64_ja-JP.msi.zip"
}
$data | ConvertTo-Json | Set-Content -Path ".tauri-updater.json"
- name: format files
run: npx -y prettier .\src-tauri\tauri.conf.json .\.tauri-updater.json --write
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: changed-files
path: |
src-tauri/tauri.conf.json
.tauri-updater.json
push-changed-files:
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: main
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: changed-files
path: changed-files
- name: Move files to correct locations
run: |
mv changed-files/src-tauri/tauri.conf.json src-tauri/tauri.conf.json
mv changed-files/.tauri-updater.json .tauri-updater.json
- name: Push updated files to main
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add src-tauri/tauri.conf.json
git add .tauri-updater.json
git commit -m "Update for release ${{ steps.variables.outputs.version }}"
git push origin main
shell: bash