diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4ce2816..c1457ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,8 @@ name: "Build Plugin" on: push: - branches: ["10.9"] + branches: + - '*' paths-ignore: - "**/README.md" - ".github/ISSUE_TEMPLATE/**" @@ -10,7 +11,8 @@ on: - "images/**" - "manifest.json" pull_request: - branches: ["10.9"] + branches: + - '*' paths-ignore: - "**/README.md" - ".github/ISSUE_TEMPLATE/**" @@ -39,6 +41,22 @@ jobs: - 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 uses: actions/setup-dotnet@v4 with: @@ -51,11 +69,19 @@ jobs: - 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 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/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 + if: ${{env.IS_BETA == 'false' }} run: dotnet restore - name: Embed version info @@ -95,7 +121,7 @@ jobs: - name: Create/replace the preview release and upload artifacts if: github.event_name != 'pull_request' run: | - gh release delete '10.9/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 delete "${{ env.MAIN_VERSION }}/preview" --cleanup-tag --yes || true + 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: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 9370f6c..fb41dc3 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -2,7 +2,8 @@ name: "CodeQL" on: push: - branches: ["10.9"] + branches: + - '*' paths-ignore: - "**/README.md" - ".github/ISSUE_TEMPLATE/**" @@ -10,7 +11,8 @@ on: - "images/**" - "manifest.json" pull_request: - branches: ["10.9"] + branches: + - '*' paths-ignore: - "**/README.md" - ".github/ISSUE_TEMPLATE/**" @@ -36,17 +38,31 @@ jobs: steps: - 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 uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - - name: Install 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 dependencies + if: ${{env.IS_BETA == 'false' }} + run: dotnet restore + - name: Initialize CodeQL uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b4bd59..134c91c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,7 @@ on: permissions: contents: write + packages: write jobs: build: @@ -13,6 +14,22 @@ jobs: steps: - 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 uses: actions/setup-dotnet@v4 with: @@ -25,11 +42,19 @@ jobs: - 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 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/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 - name: Run update version @@ -50,13 +75,13 @@ jobs: - 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 + run: gh release delete "${{ env.MAIN_VERSION }}/v${{ env.NEW_FILE_VERSION }}" --cleanup-tag --yes || true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create new release with tag 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: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -66,14 +91,14 @@ jobs: task-type: "updateManifest" env: GITHUB_REPO_VISIBILITY: ${{ github.event.repository.visibility }} - MAIN_VERSION: "10.9" + MAIN_VERSION: ${{ env.MAIN_VERSION }} - name: Deploy to Cloudflare KV uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} 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 if: success() diff --git a/VERSION.txt b/VERSION.txt new file mode 100644 index 0000000..5613601 --- /dev/null +++ b/VERSION.txt @@ -0,0 +1 @@ +10.9 \ No newline at end of file