Skip to content

improve updater

improve updater #221

Workflow file for this run

name: "publish"
on:
push:
tags:
- "v*"
# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release.
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
- platform: "windows-latest"
args: ""
runs-on: ${{ matrix.platform }}
outputs:
assets: ${{steps.tauri.outputs.artifactPaths}}
version: ${{steps.tauri.outputs.appVersion}}
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret1-dev
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
- name: install frontend dependencies
run: pnpm install # change this to npm, pnpm or bun depending on which one you use.
- name: Specify .env values
run: |
echo ETERNAL_API_TOKEN='${{ secrets.ETERNAL_API_TOKEN }}' >> ./src-tauri/.env
QUADRANT_API_KEY=${{ secrets.QUADRANT_API_KEY }} > ./src-tauri/.env
QUADRANT_OAUTH2_CLIENT_ID='${{ secrets.QUADRANT_OAUTH2_CLIENT_ID }}' >> ./src-tauri/.env
QUADRANT_OAUTH2_CLIENT_SECRET='${{ secrets.QUADRANT_OAUTH2_CLIENT_SECRET }}' >> ./src-tauri/.env
- name: Cache Cargo Cache
uses: actions/cache@v4
with:
path: src-tauri/target/release
key: ${{ matrix.platform }}-cargo-cache
- uses: tauri-apps/tauri-action@v0
id: tauri
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
tagName: Quadrant v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
releaseName: "Quadrant v__VERSION__"
releaseBody: "See the assets to download this version and install. Check out the [changelog on my blog](https://blog.mrquantumoff.dev)"
releaseDraft: true
prerelease: ${{ endsWith(github.ref_name, 'preview') }}
args: ${{ matrix.args }}
bundleIdentifier: ${{matrix.platform == 'ubuntu-22.04' && 'dev.mrquantumoff.mcmodpackmanager'}}
submit_update:
runs-on: ubuntu-latest
needs: publish-tauri
steps:
- env:
VERSION: ${{needs.publish-tauri.outputs.version}}
ASSETS: ${{toJson(needs.publish-tauri.outputs.assets)}}
run: |
echo "App version: $VERSION"
echo "App assets: $ASSETS"
curl -s -X POST --data assets --header "Authorization: ${{secrets.VERSION_UPDATE_TRIGGER_TOKEN}}"