Merge pull request #35 from Cambio-Project/refactorings #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker build and publish to GHCR | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
release: | |
types: [published] # will use tag name regardless of naming | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout current Repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Log in to the Container registry | |
run: docker login --username Cambio-Project --password ${{secrets.PUBLISH_PACKAGES}} ghcr.io | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=ref,event=tag | |
type=raw,value=latest | |
- name: Build and push Docker image | |
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 }} | |
build-args: | | |
EXECUTION_ENV=ci | |
GITHUB_PACKAGE_READ_TOKEN=${{ secrets.PUBLISH_PACKAGES }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |