110 lines
4.0 KiB
YAML
Raw Normal View History

2024-03-11 13:12:25 +01: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-05-19 13:17:08 +02:00
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
2024-03-09 07:48:03 -05:00
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- 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
run: dotnet restore
2024-05-19 13:17:08 +02:00
- name: Run update version
run: node update-version.js
2024-03-09 07:48:03 -05:00
- name: Embed version info
run: echo "${{ github.sha }}" > ConfusedPolarBear.Plugin.IntroSkipper/Configuration/version.txt
- 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: Upload artifact
uses: actions/upload-artifact@v4.3.3
2024-03-09 07:48:03 -05:00
with:
2024-05-26 01:23:38 +02:00
name: ConfusedPolarBear.Plugin.IntroSkipper-v${{ env.NEW_FILE_VERSION }}.dll
2024-09-02 20:46:48 +02:00
path: ConfusedPolarBear.Plugin.IntroSkipper/bin/Release/net6.0/ConfusedPolarBear.Plugin.IntroSkipper.dll
2024-03-09 07:48:03 -05:00
if-no-files-found: error
- name: Create archive
uses: vimtor/action-zip@v1.2
with:
files: |
ConfusedPolarBear.Plugin.IntroSkipper/bin/Debug/net6.0/ConfusedPolarBear.Plugin.IntroSkipper.dll
2024-05-26 01:23:38 +02:00
dest: intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip
2024-03-09 07:48:03 -05:00
2024-03-28 23:40:14 -04:00
- name: Generate manifest keys
2024-03-21 13:22:12 -04:00
run: |
2024-05-26 01:23:38 +02:00
sourceUrl="https://github.com/${{ github.repository }}/releases/download/10.8/v${{ env.NEW_FILE_VERSION }}/intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip"
2024-03-28 23:40:14 -04:00
echo "SOURCE_URL=$sourceUrl" >> $GITHUB_ENV
2024-05-26 01:23:38 +02:00
md5sum intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip > intro-skipper-v${{ env.NEW_FILE_VERSION }}.md5
checksum="$(awk '{print $1}' intro-skipper-v${{ env.NEW_FILE_VERSION }}.md5)"
2024-03-28 23:40:14 -04:00
echo "CHECKSUM=$checksum" >> $GITHUB_ENV
timestamp="$(date +%FT%TZ)"
echo "TIMESTAMP=$timestamp" >> $GITHUB_ENV
2024-03-09 09:10:18 -05:00
- name: Publish release
uses: 8bitDream/action-github-releases@v1.0.0
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
2024-05-26 01:23:38 +02:00
automatic_release_tag: 10.8/v${{ env.NEW_FILE_VERSION }}
prerelease: false
2024-05-26 01:23:38 +02:00
title: v${{ env.NEW_FILE_VERSION }}
files: |
2024-05-26 01:23:38 +02:00
intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip
- name: Publish release notes
uses: softprops/action-gh-release@v2.0.5
2024-03-09 07:48:03 -05:00
with:
2024-05-26 01:23:38 +02:00
tag_name: 10.8/v${{ env.NEW_FILE_VERSION }}
name: v${{ env.NEW_FILE_VERSION }}
2024-03-28 23:40:14 -04:00
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run validation and update script
run: node validate-and-update-manifest.js
env:
2024-05-26 01:23:38 +02:00
VERSION: ${{ env.NEW_FILE_VERSION }}
- 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-05-19 13:17:08 +02:00
git add manifest.json ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj
2024-05-26 01:23:38 +02:00
git commit -m "release v${{ env.NEW_FILE_VERSION }}"
git push