opengoal-launcher/.github/workflows/release.yaml
2023-03-01 20:29:49 -05:00

158 lines
5 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:
# Create the release, use `gh` CLI so we can auto generate the notes
- name: Create Release
env:
GITHUB_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
# 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
run: |
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}')
RELEASE_ID=$(gh release view "$TAG_VAL" --repo open-goal/launcher --json id --template '{{.id}}')
echo "##[set-output name=release_id;]${RELEASE_ID}"
build-app:
if: github.repository == 'open-goal/launcher'
needs: [create-release]
outputs:
jak_project_tag: ${{ steps.download_jak_project_binaries.outputs.jak_project_tag }}
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-20.04
os: linux
- platform: ubuntu-20.04
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
- name: Prepare Resources for Build
if: matrix.os == 'windows'
run: |
mv ./opengoal*.zip ./opengoal.zip
mkdir ./artifact-out
tar -xf opengoal.zip -C ./artifact-out
ls ./artifact-out
ls ./artifact-out/data
mkdir -p ./src-tauri/bin/
cp ./artifact-out/*.exe ./src-tauri/bin || true
cp ./third-party/glew_2.2.0/windows/glewinfo.exe ./src-tauri/bin
chmod +x ./src-tauri/bin/*
cp -r ./artifact-out/data ./src-tauri
mv ./metadata.json ./src-tauri/data/metadata.json
ls ./src-tauri
ls ./src-tauri/bin
ls ./src-tauri/data
- name: Prepare Resources for Build
if: matrix.os == 'linux'
run: |
mv ./opengoal*.tar.gz ./opengoal.tar.gz
mkdir ./artifact-out
tar -xf opengoal.tar.gz -C ./artifact-out
ls ./artifact-out
ls ./artifact-out/data
mkdir -p ./src-tauri/bin/
cp ./artifact-out/* ./src-tauri/bin || true
cp ./third-party/glew_2.2.0/linux/glewinfo ./src-tauri/bin
cp -r ./artifact-out/data ./src-tauri
mv ./metadata.json ./src-tauri/data/metadata.json
ls ./src-tauri
ls ./src-tauri/bin
ls ./src-tauri/data
- 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 }}
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}}
JAK_PROJ_TAG: ${{needs.build-app.outputs.jak_project_tag}}
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"