From 120b92cfccd85a55baaf4a008cc62aef80d46fb0 Mon Sep 17 00:00:00 2001 From: lokka30 <59464084+lokka30@users.noreply.github.com> Date: Thu, 21 Nov 2024 06:12:12 +0800 Subject: [PATCH] workflows: begin work on docker image deployment (#214) * workflows: begin work on docker image deployment Started work on `docker.yml` for automatic docker image deployment on pushes to to branches (notably, excluding people's PRs). Useful resource: * workflows: Minor adjustments to deploy-docker-image action * workflows: updated docker image workflow according to GH docs * workflows: temporarily test deployment via docker-deploy branch * workflows: use only subject-name for attestation * workflows: specify subject-path for attestation * workflows: remove attestation for now, too fiddly * workflows: remove tmp test branch --- .github/workflows/docker.yml | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..7390e1aa4 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,47 @@ +name: deploy-docker-image + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +on: + push: + branches: + - "master" + +jobs: + docker-build-deploy: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to GitHub CR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and Push + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}