name: CI/CD on: push: branches: [master, main] pull_request: branches: [master, main] workflow_dispatch: permissions: contents: read actions: write jobs: build-and-push: name: Build & Push Docker Image runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' outputs: image_tag: ${{ steps.meta.outputs.tag }} steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Generate image metadata id: meta run: | SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) echo "tag=${SHORT_SHA}" >> $GITHUB_OUTPUT echo "Image will be tagged: ${SHORT_SHA}" - name: Login to registry run: | echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login registry.johnogle.info -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: | registry.johnogle.info/johno/decypharr:${{ steps.meta.outputs.tag }} registry.johnogle.info/johno/decypharr:latest cache-from: type=gha cache-to: type=gha,mode=max build-args: | VERSION=${{ steps.meta.outputs.tag }} CHANNEL=dev