Skip to content

Commit

Permalink
Merge pull request #342 from YaSuenag/release-workflow
Browse files Browse the repository at this point in the history
LGTM - we may create a sub workflow for the image generation in the future

Add 4-release.yaml to publish container image for the release
  • Loading branch information
danuw committed Jun 5, 2023
2 parents d3ca5b1 + 314ed12 commit b3b3189
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/4-release.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b3b3189

Please sign in to comment.