opengoal-launcher/.github/workflows/release.yaml
2023-03-12 17:04:57 -04:00

139 lines
4 KiB
YAML

name: Release
on:
push:
tags:
- v*
jobs:
create-release:
if: github.repository == 'open-goal/launcher'
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.get_release_id.outputs.release_id }}
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_PAT }}
# Create the release, use `gh` CLI so we can auto generate the notes
- name: Create Release
env:
GH_TOKEN: ${{ secrets.BOT_PAT }}
run: |
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
gh release create ${TAG_VAL} --generate-notes --draft --repo open-goal/launcher
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
- name: Install NPM Dependencies
run: |
yarn install --frozen-lockfile
# Get the internal ID of the release so that Tauri's action can use it to upload assets
- name: Get Release ID
id: get_release_id
env:
GH_TOKEN: ${{ secrets.BOT_PAT }}
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
run: |
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
RELEASE_ID=$(TAG_NAME="$TAG_VAL" yarn --silent release-id)
echo "release_id=${RELEASE_ID}" >> $GITHUB_OUTPUT
build-app:
if: github.repository == 'open-goal/launcher'
needs: [create-release]
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-20.04
os: linux
- platform: windows-latest
os: windows
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_PAT }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
- name: Install Rust Stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
name: Cache Rust Build
with:
shared-key: tauri-build-${{ matrix.platform }}
workspaces: src-tauri
- name: Install Linux Dependencies
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 libglew2.1 patchelf
- name: Install NPM Dependencies
run: |
yarn install --frozen-lockfile
yarn package
yarn build
- name: Prepare Release Config
run: yarn prepare-release-config
- uses: tauri-apps/tauri-action@v0
name: Build Tauri App
timeout-minutes: 30
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
configPath: "./.tauri/release-config.combined.json"
releaseId: ${{needs.create-release.outputs.release_id}}
publish-release:
if: github.repository == 'open-goal/launcher'
needs: [create-release, build-app]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_PAT }}
ref: main
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
- name: update release metadata and publish the release
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
RELEASE_ID: ${{needs.create-release.outputs.release_id}}
run: |
yarn install --frozen-lockfile
yarn update-release-meta
- name: commit release metadata change
uses: EndBug/add-and-commit@v9
with:
default_author: github_actor
author_name: "OpenGOALBot"
author_email: "OpenGOALBot@users.noreply.github.com"
message: "release: update release metadata to latest"