name: CI/CD Pipeline on: push: branches: - '5108-chunked-upload-support' pull_request: branches: - '5108-chunked-upload-support' env: REGISTRY: ghcr.io # This automatically resolves to kc9wwh/audiobookshelf IMAGE_NAME: ${{ github.repository }} jobs: test-and-build: name: Test Node Build runs-on: ubuntu-latest permissions: contents: read steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' # Standard for modern ABS cache: 'npm' - name: Install dependencies run: npm ci - name: Run tests run: npm test --if-present docker-publish: name: Build and Push to GHCR needs: test-and-build runs-on: ubuntu-latest permissions: contents: read packages: write # Critical: allows pushing the image to ghcr.io steps: - name: Checkout repository uses: actions/checkout@v4 - name: Log in to the Container registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=branch type=sha # This creates a tag like ghcr.io/kc9wwh/audiobookshelf:5108-chunked-upload-support - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}