From 314ed1256ddd345ad6d802e6a41a274d1ed3a5b1 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Thu, 27 Apr 2023 10:12:16 +0900 Subject: [PATCH] Add 4-release.yaml Signed-off-by: Yasumasa Suenaga --- .github/workflows/4-release.yaml | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/4-release.yaml diff --git a/.github/workflows/4-release.yaml b/.github/workflows/4-release.yaml new file mode 100644 index 000000000..b4eaa34d1 --- /dev/null +++ b/.github/workflows/4-release.yaml @@ -0,0 +1,43 @@ +name: Publish container image to GitHub Packages + +on: + release: + types: [published] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + publish-container-image: + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Log in to the Container registry + uses: docker/login-action@v2.1.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4.3.0 + with: + flavor: latest=true + tags: type=raw,value=${{ github.ref_name }} + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@v4.0.0 + with: + context: "{{defaultContext}}:src" + file: CarbonAware.WebApi/src/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + provenance: false