82 lines
3.1 KiB
YAML
Raw Normal View History

2024-04-04 09:39:39 -04:00
name: 'Release Plugin'
2024-03-09 07:48:03 -05:00
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2024-09-28 17:42:46 +02:00
2024-03-09 07:48:03 -05:00
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
2024-03-22 23:41:58 +01:00
dotnet-version: 8.0.x
2024-03-09 07:48:03 -05:00
- name: Setup Node.js
uses: actions/setup-node@v4
with:
2024-10-06 13:25:05 +02:00
node-version: 'lts/*'
- name: Install html-minifier-terser
run: npm install terser html-minifier-terser
- name: Minify HTML
run: |
npx html-minifier-terser --collapse-boolean-attributes --collapse-whitespace --collapse-inline-tag-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html
npx terser ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js -c -m
npx terser ConfusedPolarBear.Plugin.IntroSkipper/Configuration/visualizer.js -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/visualizer.js -c -m
2024-03-09 07:48:03 -05:00
- name: Restore dependencies
2024-05-11 20:09:29 +00:00
run: dotnet restore
2024-03-09 07:48:03 -05:00
2024-05-19 13:17:08 +02:00
- name: Run update version
2024-09-28 17:42:46 +02:00
uses: intro-skipper/intro-skipper-action-ts@main
with:
task-type: 'updateVersion'
2024-05-19 13:17:08 +02:00
2024-03-09 07:48:03 -05:00
- name: Embed version info
2024-09-21 18:42:55 +02:00
run: |
GITHUB_SHA=${{ github.sha }}
sed -i "s/string\.Empty/\"$GITHUB_SHA\"/g" ConfusedPolarBear.Plugin.IntroSkipper/Helper/Commit.cs
2024-03-09 07:48:03 -05:00
- name: Build
2024-09-02 20:46:48 +02:00
run: dotnet build --configuration Release --no-restore
2024-03-09 07:48:03 -05:00
- name: Create archive
2024-09-02 20:46:48 +02:00
run: zip -j "intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip" ConfusedPolarBear.Plugin.IntroSkipper/bin/Release/net8.0/ConfusedPolarBear.Plugin.IntroSkipper.dll
- name: Remove old release if exits
if: ${{ github.repository == 'intro-skipper/intro-skipper-test' }}
run: gh release delete "10.9/v${{ env.NEW_FILE_VERSION }}" --cleanup-tag --yes || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2024-03-09 09:10:18 -05:00
- name: Create new release with tag
if: github.event_name != 'pull_request'
2024-08-27 20:58:55 +02:00
run: gh release create "10.9/v${{ env.NEW_FILE_VERSION }}" "intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip" --title "v${{ env.NEW_FILE_VERSION }}" --latest --generate-notes
2024-03-29 20:40:49 +01:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run validation and update script
2024-09-28 17:42:46 +02:00
uses: intro-skipper/intro-skipper-action-ts@main
with:
task-type: 'updateManifest'
env:
GITHUB_REPO_VISIBILITY: ${{ github.event.repository.visibility }}
- name: Commit changes
if: success()
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
2024-09-27 21:25:49 +02:00
git add README.md manifest.json ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj .github/ISSUE_TEMPLATE/bug_report_form.yml
2024-05-26 01:23:38 +02:00
git commit -m "release v${{ env.NEW_FILE_VERSION }}"
git push