diff --git a/.github/workflows/deploy_image.yml b/.github/workflows/deploy_image.yml new file mode 100644 index 000000000..7dffa9740 --- /dev/null +++ b/.github/workflows/deploy_image.yml @@ -0,0 +1,66 @@ +name: Deploy Jumble Container Image +on: + push: + # tags: + # - 'v[0-9]+.[0-9]+.[0-9]+' # Only build on tag with semantic versioning format + branches: [master] + workflow_dispatch: + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + push_image: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set Variables + uses: actions/github-script@v7 + id: set_variables + with: + script: | + // convert everything to lowercase because ghcr repository name must be lowercase + const actor = context.actor.toLowerCase(); + const repository = context.repo.repo.toLowerCase(); + core.setOutput('actor', actor); + core.setOutput('repository', repository); + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v6 + with: + images: ${{ env.REGISTRY }}/${{ steps.set_variables.outputs.actor }}/${{ steps.set_variables.outputs.repository }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max