ci: make github actions reusable
This commit is contained in:
parent
8d0f17e18b
commit
8627203748
36
.github/workflows/build.yml
vendored
36
.github/workflows/build.yml
vendored
@ -2,7 +2,8 @@ name: "Build Plugin"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["10.9"]
|
branches:
|
||||||
|
- '*'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**/README.md"
|
- "**/README.md"
|
||||||
- ".github/ISSUE_TEMPLATE/**"
|
- ".github/ISSUE_TEMPLATE/**"
|
||||||
@ -10,7 +11,8 @@ on:
|
|||||||
- "images/**"
|
- "images/**"
|
||||||
- "manifest.json"
|
- "manifest.json"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["10.9"]
|
branches:
|
||||||
|
- '*'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**/README.md"
|
- "**/README.md"
|
||||||
- ".github/ISSUE_TEMPLATE/**"
|
- ".github/ISSUE_TEMPLATE/**"
|
||||||
@ -39,6 +41,22 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Read version from VERSION.txt
|
||||||
|
id: read-version
|
||||||
|
run: |
|
||||||
|
MAIN_VERSION=$(cat VERSION.txt)
|
||||||
|
echo "MAIN_VERSION=${MAIN_VERSION}"
|
||||||
|
echo "MAIN_VERSION=$MAIN_VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Check for BETA file
|
||||||
|
id: check-beta
|
||||||
|
run: |
|
||||||
|
if [ -f "BETA" ]; then
|
||||||
|
echo "IS_BETA=true" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IS_BETA=false" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
@ -51,11 +69,19 @@ jobs:
|
|||||||
|
|
||||||
- name: Minify HTML
|
- name: Minify HTML
|
||||||
run: |
|
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 html-minifier-terser --collapse-boolean-attributes --collapse-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/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
|
npx terser ConfusedPolarBear.Plugin.IntroSkipper/Configuration/visualizer.js -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/visualizer.js -c -m
|
||||||
|
|
||||||
|
- name: Restore Beta dependencies
|
||||||
|
if: ${{env.IS_BETA == 'true' }}
|
||||||
|
run: |
|
||||||
|
dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name jellyfin-pre "https://nuget.pkg.github.com/jellyfin/index.json"
|
||||||
|
dotnet tool install --global dotnet-outdated-tool
|
||||||
|
dotnet outdated -pre Always -u -inc Jellyfin
|
||||||
|
|
||||||
- name: Restore dependencies
|
- name: Restore dependencies
|
||||||
|
if: ${{env.IS_BETA == 'false' }}
|
||||||
run: dotnet restore
|
run: dotnet restore
|
||||||
|
|
||||||
- name: Embed version info
|
- name: Embed version info
|
||||||
@ -95,7 +121,7 @@ jobs:
|
|||||||
- name: Create/replace the preview release and upload artifacts
|
- name: Create/replace the preview release and upload artifacts
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
run: |
|
run: |
|
||||||
gh release delete '10.9/preview' --cleanup-tag --yes || true
|
gh release delete "${{ env.MAIN_VERSION }}/preview" --cleanup-tag --yes || true
|
||||||
gh release create '10.9/preview' "intro-skipper-${{ env.GIT_HASH }}.zip" --prerelease --title "intro-skipper-${{ env.GIT_HASH }}" --notes "This is a prerelease version." --target "10.9"
|
gh release create "${{ env.MAIN_VERSION }}/preview" "intro-skipper-${{ env.GIT_HASH }}.zip" --prerelease --title "intro-skipper-${{ env.GIT_HASH }}" --notes "This is a prerelease version." --target ${{ env.MAIN_VERSION }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
22
.github/workflows/codeql.yml
vendored
22
.github/workflows/codeql.yml
vendored
@ -2,7 +2,8 @@ name: "CodeQL"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["10.9"]
|
branches:
|
||||||
|
- '*'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**/README.md"
|
- "**/README.md"
|
||||||
- ".github/ISSUE_TEMPLATE/**"
|
- ".github/ISSUE_TEMPLATE/**"
|
||||||
@ -10,7 +11,8 @@ on:
|
|||||||
- "images/**"
|
- "images/**"
|
||||||
- "manifest.json"
|
- "manifest.json"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["10.9"]
|
branches:
|
||||||
|
- '*'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**/README.md"
|
- "**/README.md"
|
||||||
- ".github/ISSUE_TEMPLATE/**"
|
- ".github/ISSUE_TEMPLATE/**"
|
||||||
@ -36,17 +38,31 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check for BETA file
|
||||||
|
id: check-beta
|
||||||
|
run: |
|
||||||
|
if [ -f "BETA" ]; then
|
||||||
|
echo "IS_BETA=true" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IS_BETA=false" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: 8.0.x
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Restore Beta dependencies
|
||||||
|
if: ${{env.IS_BETA == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name jellyfin-pre "https://nuget.pkg.github.com/jellyfin/index.json"
|
dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name jellyfin-pre "https://nuget.pkg.github.com/jellyfin/index.json"
|
||||||
dotnet tool install --global dotnet-outdated-tool
|
dotnet tool install --global dotnet-outdated-tool
|
||||||
dotnet outdated -pre Always -u -inc Jellyfin
|
dotnet outdated -pre Always -u -inc Jellyfin
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
if: ${{env.IS_BETA == 'false' }}
|
||||||
|
run: dotnet restore
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
|
uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
|
||||||
with:
|
with:
|
||||||
|
37
.github/workflows/release.yml
vendored
37
.github/workflows/release.yml
vendored
@ -5,6 +5,7 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -13,6 +14,22 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Read version from VERSION.txt
|
||||||
|
id: read-version
|
||||||
|
run: |
|
||||||
|
MAIN_VERSION=$(cat VERSION.txt)
|
||||||
|
echo "MAIN_VERSION=${MAIN_VERSION}"
|
||||||
|
echo "MAIN_VERSION=$MAIN_VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Check for BETA file
|
||||||
|
id: check-beta
|
||||||
|
run: |
|
||||||
|
if [ -f "BETA" ]; then
|
||||||
|
echo "IS_BETA=true" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IS_BETA=false" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
@ -25,11 +42,19 @@ jobs:
|
|||||||
|
|
||||||
- name: Minify HTML
|
- name: Minify HTML
|
||||||
run: |
|
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 html-minifier-terser --collapse-boolean-attributes --collapse-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/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
|
npx terser ConfusedPolarBear.Plugin.IntroSkipper/Configuration/visualizer.js -o ConfusedPolarBear.Plugin.IntroSkipper/Configuration/visualizer.js -c -m
|
||||||
|
|
||||||
- name: Restore dependencies
|
- name: Restore Beta dependencies
|
||||||
|
if: ${{env.IS_BETA == 'true' }}
|
||||||
|
run: |
|
||||||
|
dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name jellyfin-pre "https://nuget.pkg.github.com/jellyfin/index.json"
|
||||||
|
dotnet tool install --global dotnet-outdated-tool
|
||||||
|
dotnet outdated -pre Always -u -inc Jellyfin
|
||||||
|
|
||||||
|
- name: Restore Beta
|
||||||
|
if: ${{env.IS_BETA == 'false' }}
|
||||||
run: dotnet restore
|
run: dotnet restore
|
||||||
|
|
||||||
- name: Run update version
|
- name: Run update version
|
||||||
@ -50,13 +75,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Remove old release if exits
|
- name: Remove old release if exits
|
||||||
if: ${{ github.repository == 'intro-skipper/intro-skipper-test' }}
|
if: ${{ github.repository == 'intro-skipper/intro-skipper-test' }}
|
||||||
run: gh release delete "10.9/v${{ env.NEW_FILE_VERSION }}" --cleanup-tag --yes || true
|
run: gh release delete "${{ env.MAIN_VERSION }}/v${{ env.NEW_FILE_VERSION }}" --cleanup-tag --yes || true
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Create new release with tag
|
- name: Create new release with tag
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
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 --target "10.9" --generate-notes
|
run: gh release create "${{ env.MAIN_VERSION }}/v${{ env.NEW_FILE_VERSION }}" "intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip" --title "v${{ env.NEW_FILE_VERSION }}" --latest --generate-notes --target ${{ env.MAIN_VERSION }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
@ -66,14 +91,14 @@ jobs:
|
|||||||
task-type: "updateManifest"
|
task-type: "updateManifest"
|
||||||
env:
|
env:
|
||||||
GITHUB_REPO_VISIBILITY: ${{ github.event.repository.visibility }}
|
GITHUB_REPO_VISIBILITY: ${{ github.event.repository.visibility }}
|
||||||
MAIN_VERSION: "10.9"
|
MAIN_VERSION: ${{ env.MAIN_VERSION }}
|
||||||
|
|
||||||
- name: Deploy to Cloudflare KV
|
- name: Deploy to Cloudflare KV
|
||||||
uses: cloudflare/wrangler-action@v3
|
uses: cloudflare/wrangler-action@v3
|
||||||
with:
|
with:
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
command: kv key put --namespace-id=${{ github.repository == 'intro-skipper/intro-skipper-test' && '49c07e5b68074443b940de893d58a997' || '61215c51799a4de59f0a33a8b7aecb0e' }} "10.9" --path=manifest.json
|
command: kv key put --namespace-id=${{ github.repository == 'intro-skipper/intro-skipper-test' && '49c07e5b68074443b940de893d58a997' || '61215c51799a4de59f0a33a8b7aecb0e' }} ${{ env.MAIN_VERSION }} --path=manifest.json
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
if: success()
|
if: success()
|
||||||
|
1
VERSION.txt
Normal file
1
VERSION.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
10.9
|
Loading…
x
Reference in New Issue
Block a user