Skip to content

Commit

Permalink
Extract metadate only once and set a default image name
Browse files Browse the repository at this point in the history
  • Loading branch information
finsberg committed May 28, 2024
1 parent 99d0136 commit 7cf99d1
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions .github/workflows/build-publish-fenics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: fenics

jobs:
build-and-push-image:
Expand All @@ -51,16 +52,20 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker (testing)
id: meta-testing
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.title=${{ github.run_id }}-${{ github.run_attempt }}
org.opencontainers.image.description="Test run"
images: test-image-${{ github.run_id }}-${{ github.run_attempt }}
org.opencontainers.image.title=${{ github.event.inputs.image_name || env.IMAGE_NAME }}
org.opencontainers.image.description=${{ github.event.inputs.image_description }}
- name: Build (FEniCS) AMD docker image
images: ${{ github.GITHUB_REPOSITORY }}/${{ github.event.inputs.image_name || env.IMAGE_NAME }}
tags: |
type=raw,value=${{ github.event.inputs.release_tag }}
- name: Build AMD docker image
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:fenics"
Expand All @@ -69,20 +74,10 @@ jobs:
platforms: linux/amd64
tags: ${{ steps.meta-testing.outputs.tags }}
labels: ${{ steps.meta-testing.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ github.event.inputs.image_name }}:${{ github.event.inputs.release_tag }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ github.event.inputs.image_name || env.IMAGE_NAME }}:${{ github.event.inputs.release_tag }}
cache-to: type=inline

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.title=${{ github.event.inputs.image_name }}
org.opencontainers.image.description=${{ github.event.inputs.image_description }}
images: ${{ github.GITHUB_REPOSITORY }}/${{ github.event.inputs.image_name }}
tags: |
type=raw,value=${{ github.event.inputs.release_tag }}


- name: Trigger circleci build for ARM
if: ${{ github.event_name == 'workflow_dispatch' }}
Expand Down

0 comments on commit 7cf99d1

Please sign in to comment.