opengoal-launcher/.github/workflows/kickoff-release.yaml

81 lines
2.8 KiB
YAML
Raw Normal View History

name: Kick off Release
on:
repository_dispatch:
types: [releaseLauncher]
workflow_dispatch:
inputs:
bump:
description: "Semver Bump Type"
required: true
default: "patch"
type: choice
options:
- patch
- minor
- major
jobs:
kick-off-release:
if: github.repository == 'open-goal/launcher'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_PAT }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: Install Rust Stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Bump Version - Manual Kickoff
id: version-bump
if: github.event_name != 'repository_dispatch'
run: |
npm version ${{ github.event.inputs.bump }} --no-git-tag-version
NEW_VERSION=$(awk '/version/{gsub(/("|",)/,"",$2);print $2}' package.json)
sed -i "/APP_VERSION/c\version = \""$NEW_VERSION"\" # APP_VERSION" ./src-tauri/Cargo.toml
sed -i "/\"version\":/c\ \"version\": \""$NEW_VERSION"\"" ./src-tauri/tauri.conf.json
cd ./src-tauri
cargo generate-lockfile
echo "##[set-output name=new_version;]${NEW_VERSION}"
- name: Commit Version Bump
uses: EndBug/add-and-commit@v9
if: github.event_name != 'repository_dispatch'
with:
default_author: github_actor
author_name: "OpenGOALBot"
author_email: "OpenGOALBot@users.noreply.github.com"
message: "release: bump to version - ${{ steps.version-bump.outputs.new_version }}"
tag: "v${{ steps.version-bump.outputs.new_version }}"
- name: Bump Minor Version - Jak Project Release
id: version-bump-jak-prj
if: github.event_name == 'repository_dispatch'
run: |
npm version minor --no-git-tag-version
NEW_VERSION=$(awk '/version/{gsub(/("|",)/,"",$2);print $2}' package.json)
sed -i "/APP_VERSION/c\version = \""$NEW_VERSION"\" # APP_VERSION" ./src-tauri/Cargo.toml
sed -i "/\"version\":/c\ \"version\": \""$NEW_VERSION"\"" ./src-tauri/tauri.conf.json
cd ./src-tauri
cargo generate-lockfile
echo "##[set-output name=new_version;]${NEW_VERSION}"
- name: Commit Version Bump
uses: EndBug/add-and-commit@v9
if: github.event_name == 'repository_dispatch'
with:
default_author: github_actor
author_name: "OpenGOALBot"
author_email: "OpenGOALBot@users.noreply.github.com"
message: "release: bump to version - ${{ steps.version-bump-jak-prj.outputs.new_version }}"
tag: "v${{ steps.version-bump-jak-prj.outputs.new_version }}"