Skip to content

oopsy: fix oopsy_viewer to support delay/suppress properties (#449) #17

oopsy: fix oopsy_viewer to support delay/suppress properties (#449)

oopsy: fix oopsy_viewer to support delay/suppress properties (#449) #17

Workflow file for this run

name: Create Release Artifact
on:
push:
branches:
- main
paths:
- 'package.json'
jobs:
validate_tag:
runs-on: ubuntu-latest
if: ${{ github.repository == 'OverlayPlugin/cactbot' }}
outputs:
version: ${{ steps.get_version.outputs.version }}
do_release: ${{ steps.check_tag.outputs.do_release }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Project Version
id: get_version
uses: 'euberdeveloper/ga-project-version@main'
- name: Check Tag Exists
id: check_tag
shell: bash
run: |
if [ "${{ steps.get_version.outputs.version }}" == "" ]; then
echo "Error: Unable to determine version from package.json"
exit 1
elif [ "$(git tag -l 'v${{ steps.get_version.outputs.version }}')" ]; then
echo "No version bump - ${{ steps.get_version.outputs.version }}."
echo "do_release=false" >> $GITHUB_OUTPUT
echo "Skipping remaining jobs."
else
echo "Version bump detected - ${{ steps.get_version.outputs.version }}"
echo "do_release=true" >> $GITHUB_OUTPUT
fi
validate_versions:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup-js-env
- name: Validate AssemblyInfo Versions
run: |
npm run validate-versions
create_release:
runs-on: windows-latest
needs: [validate_tag, validate_versions]
if: |
github.repository == 'OverlayPlugin/cactbot' &&
needs.validate_tag.outputs.do_release == 'true'
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up msbuild
uses: microsoft/setup-msbuild@v1.0.2
- uses: ./.github/actions/setup-js-env
- name: Check dependencies cache
id: cache-dependencies
uses: actions/cache@v3
with:
path: ./plugin/ThirdParty
key: |
${{ runner.os }}-cactbot-${{ hashFiles('./util/fetch_deps.ts',
'./util/DEPS.json5') }}
restore-keys: |
${{ runner.os }}-cactbot-
- name: Fetch Dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
npm run fetch-deps
shell: bash
- name: Build Cactbot Plugin
shell: cmd
run: |
msbuild /p:Configuration=Release /p:Platform=x64 plugin/Cactbot.sln
- name: Build JavaScript UI Module Bundles
run: |
npm run build
- name: Setup Staging Directory
run: |
./util/publish.sh
shell: bash
- name: Create Release Artifact
run: |
mkdir cactbot
mv publish/cactbot-release/cactbot/ cactbot
compress-archive cactbot cactbot-${{ needs.validate_tag.outputs.version }}.zip
shell: pwsh
- name: Create Tag
shell: bash
run: git tag "v${{ needs.validate_tag.outputs.version }}" && git push --tags
- name: Fetch Release Attributes
id: fetch_attributes
uses: zoexx/github-action-json-file-properties@release
with:
file_path: "package.json"
- name: Set Release Attributes
id: set_attributes
# Using pwsh, so output must be sent to $env:GITHUB_OUTPUT instead of $GITHUB_OUTPUT
shell: pwsh
run: |
$release_name = "${{ needs.validate_tag.outputs.version }}";
$release_draft = "false";
$release_summary = "${{steps.fetch_attributes.outputs.releaseSummary}}";
if ($release_summary) {
$release_name += ": " + $release_summary;
}
if ("${{steps.fetch_attributes.outputs.releaseInDraft}}" -eq "true") {
$release_draft = "true";
}
echo "Release Name: $release_name";
echo "Release as Draft: $release_draft";
echo "release_name=$release_name" >> $env:GITHUB_OUTPUT
echo "release_draft=$release_draft" >> $env:GITHUB_OUTPUT
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: ${{ steps.set_attributes.outputs.release_name }}
tag: v${{ needs.validate_tag.outputs.version }}
artifacts: cactbot-${{ needs.validate_tag.outputs.version }}.zip
artifactContentType: application/zip
draft: ${{ steps.set_attributes.outputs.release_draft }}
generateReleaseNotes: true
create_npm_package:
needs: [create_release]
runs-on: ubuntu-latest
if: ${{ github.repository == 'OverlayPlugin/cactbot' }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
- uses: ./.github/actions/setup-js-env
- run: node .github/scripts/npm-package.cjs
- run: npm publish
working-directory: npm-package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}