Skip to content

Update main.yml

Update main.yml #9

Workflow file for this run

name: 'Publish new release'
on:
push:
branches: [main]
paths-ignore:
- "*.md"
- "LICENSE"
- ".gitignore"
- "*.yml"
workflow_dispatch:
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
jobs:
create-release:
permissions:
contents: write
runs-on: ubuntu-20.04
outputs:
release_id: ${{ steps.create-release.outputs.result }}
steps:
- uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
- 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: `Dredge Mod Manager v${process.env.PACKAGE_VERSION}`,
body: 'An application for installing Dredge mods for use with the Winch mod loader',
draft: true,
prerelease: false
})
return data.id
build-tauri:
needs: create-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [windows-latest, ubuntu-22.04]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo add-apt-repository 'deb http://gb.archive.ubuntu.com/ubuntu jammy main'
sudo apt-get update
sudo apt-get install -y gir1.2-webkit2-4.0=2.44.3-0ubuntu0.22.04.1 libjavascriptcoregtk-4.0-dev libjavascriptcoregtk-4.0-18=2.36.0-2ubuntu1 libgtk-3-dev libwebkit2gtk-4.0-dev=2.36.0-2ubuntu1 libwebkit2gtk-4.0-37=2.36.0-2ubuntu1 libwebkit2gtk-4.0-37=2.36.0-2ubuntu1 libappindicator3-dev librsvg2-dev patchelf gir1.2-javascriptcoregtk-4.0
- name: install frontend dependencies
run: npm install
- 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: true,
prerelease: false
})
write-changelog:
permissions: write-all
runs-on: windows-latest
needs: [publish-release, create-release]
steps:
- name: download latest.json
uses: robinraju/release-downloader@v1.8
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
fileName: "latest.json"
- name: Update latest.json notes
uses: jossef/action-set-json-field@v2.1
with:
file: latest.json
field: notes
value: ${{ github.event.head_commit.message }}
- name: Upload latest.json
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "latest.json"
overwrite: true
release_id: ${{ needs.create-release.outputs.release_id }}