diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecc292c..5876d84 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: run: dotnet build --no-restore - name: Upload artifact - uses: actions/upload-artifact@v3.1.1 + uses: actions/upload-artifact@v3.1.2 with: name: intro-skipper-${{ github.sha }}.dll path: ConfusedPolarBear.Plugin.IntroSkipper/bin/Debug/net6.0/ConfusedPolarBear.Plugin.IntroSkipper.dll diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 7972f47..14cf41b 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -7,77 +7,116 @@ on: env: REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository_owner }}/jellyfin-intro-skipper jobs: build: runs-on: ubuntu-latest permissions: + contents: read packages: write strategy: matrix: node-version: [18.x] + jellyfin-version: [10.8.9] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Login to GHCR - uses: docker/login-action@v2.1.0 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} + - name: Get npm cache directory + id: npm-cache-dir + run: | + echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT - - name: Get npm cache directory - id: npm-cache-dir - run: | - echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT + - name: Configure npm cache + uses: actions/cache@v3 + id: npm-cache + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - - name: Configure npm cache - uses: actions/cache@v3 - id: npm-cache - with: - path: ${{ steps.npm-cache-dir.outputs.dir }} - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- + - name: Checkout modified web interface + uses: actions/checkout@v3 + with: + repository: ConfusedPolarBear/jellyfin-web + ref: intros + path: web - - name: Checkout modified web interface - uses: actions/checkout@v3 - with: - repository: ConfusedPolarBear/jellyfin-web - ref: intros - path: web + - name: Store commit of web interface + id: web-commit + run: | + cd web + echo "commit=$(git log -1 --format='%H' | cut -c -10)" >> $GITHUB_OUTPUT - - name: Store commit of web interface - id: web-commit - run: | - cd web - echo "commit=$(git log -1 --format='%H' | cut -c -10)" >> $GITHUB_OUTPUT + - name: Build and copy web interface + run: | + cd web + npm install + cp -r dist ../docker/ + tar czf dist.tar.gz dist - - name: Build and copy web interface - run: | - cd web - npm install - cp -r dist ../docker/ - tar czf dist.tar.gz dist + - name: Upload web interface + uses: actions/upload-artifact@v3.1.2 + with: + name: jellyfin-web-10.8.0+${{ steps.web-commit.outputs.commit }}.tar.gz + path: web/dist.tar.gz + if-no-files-found: error - - name: Upload web interface - uses: actions/upload-artifact@v3.1.1 - with: - name: jellyfin-web-10.8.0+${{ steps.web-commit.outputs.commit }}.tar.gz - path: web/dist.tar.gz - if-no-files-found: error + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 - - name: Publish container - uses: docker/build-push-action@v3.2.0 - with: - file: docker/Dockerfile - context: docker/ - push: true - tags: ${{ env.REGISTRY}}/confusedpolarbear/jellyfin-intro-skipper:${{ steps.web-commit.outputs.commit }} + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into ghcr.io registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2.1.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type-raw,value=${{ steps.web-commit.outputs.commit }} + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}},value=${{ matrix.jellyfin-version }} + + # Build and push Docker image with Buildx + # https://github.com/docker/build-push-action + - name: Publish container image + id: build-and-push + uses: docker/build-push-action@v4.0.0 + with: + file: docker/Dockerfile + context: docker + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + JELLYFIN_TAG=${{ matrix.jellyfin-version }} + platforms: | + linux/amd64 + linux/arm/v7 + linux/arm64/v8 + push: ${{ github.event_name != 'pull_request' }} + pull: true + no-cache: true + cache-from: type=gha + cache-to: type=gha,mode=max + provenance: false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0edecc7..4254862 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,7 +32,7 @@ jobs: run: .github/workflows/package.sh ${{ steps.tag.outputs.tag }} - name: Upload plugin archive - uses: actions/upload-artifact@v3.1.1 + uses: actions/upload-artifact@v3.1.2 with: name: intro-skipper-bundle-${{ steps.tag.outputs.tag }}.zip path: | diff --git a/docker/Dockerfile b/docker/Dockerfile index 2e4d794..cd3d064 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,3 +1,4 @@ -FROM jellyfin/jellyfin:10.8.9 +ARG JELLYFIN_TAG=10.8.9 +FROM jellyfin/jellyfin:${JELLYFIN_TAG} COPY dist/ /jellyfin/jellyfin-web/