build: Bump version to 0.30.12 (#6059) #202
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Release Artifact | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'plugin/CactbotEventSource/Properties/AssemblyInfo.cs' | |
jobs: | |
validate_tag: | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'quisquous/cactbot' }} | |
outputs: | |
version: ${{ steps.determine_version.outputs.version }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Determine Version | |
id: determine_version | |
shell: pwsh | |
run: | | |
$text = [System.IO.File]::ReadAllText("plugin/CactbotEventSource/Properties/AssemblyInfo.cs"); | |
$regex = [regex]::New('\[assembly: AssemblyVersion\("([0-9]+\.[0-9]+\.[0-9]+)\.[0-9]+"\)'); | |
$m = $regex.Match($text); | |
if (-not $m) { | |
echo "Error: Version number not found in the AssemblyInfo.cs!" | |
exit 1 | |
} | |
$version = $m.Groups[1] | |
echo "::set-output name=version::$version" | |
- name: Check Tag Exists | |
shell: bash | |
run: | | |
if [ $(git tag -l "v${{ steps.determine_version.outputs.version }}") ]; then | |
echo "Error: Existing git tag found. Exiting..." | |
exit 1 | |
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 == 'quisquous/cactbot' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up msbuild | |
uses: microsoft/[email protected] | |
- 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: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: ${{ needs.validate_tag.outputs.version }} | |
tag: v${{ needs.validate_tag.outputs.version }} | |
artifacts: cactbot-${{ needs.validate_tag.outputs.version }}.zip | |
artifactContentType: application/zip | |
draft: true | |
generateReleaseNotes: true | |
create_npm_package: | |
needs: [create_release] | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'quisquous/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 }} |