From 86401278e3b938811441aebdf2cdb4e2c1790f33 Mon Sep 17 00:00:00 2001 From: Oguzhan Yilmaz Date: Sun, 8 Dec 2024 21:14:04 +0300 Subject: [PATCH] add docker build github action --- .github/workloads/docker-build-publish.yaml | 50 +++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workloads/docker-build-publish.yaml diff --git a/.github/workloads/docker-build-publish.yaml b/.github/workloads/docker-build-publish.yaml new file mode 100644 index 0000000..6beb592 --- /dev/null +++ b/.github/workloads/docker-build-publish.yaml @@ -0,0 +1,50 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: Build and publish a pyCrossfade Docker image to ghcr.io +on: + # publish on releases, e.g. v2.1.13 (image tagged as "2.1.13" - "v" prefix is removed) + release: + types: [ published ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: pycrossfade + +jobs: + build-and-push-balcony-docker-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GHCR_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}