From 3a7fae33dd4e90bb828490b821572b80eaf9f12d Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Sun, 3 Nov 2024 20:04:54 -0800 Subject: [PATCH] Use Gha docker metadata actions to setup all the github actions --- .github/workflows/package.yaml | 35 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 33be9483e..d19a02fb2 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -241,7 +241,6 @@ jobs: # Change all uppercase to lowercase IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') echo IMAGE_ID=${IMAGE_ID} - echo ::set-output name=IMAGE_ID::${IMAGE_ID} - name: Get the version @@ -254,16 +253,28 @@ jobs: # Use Docker `latest` tag convention [ "$VERSION" == "master" ] && VERSION=latest echo VERSION=${VERSION} - echo ::set-output name=VERSION::${VERSION} - - name: Build Docker Image and push to registry - run: | - docker buildx build --push \ - --platform=linux/amd64,linux/arm64 \ - --cache-from=type=local,src=/tmp/build-cache/amd64 \ - --cache-from=type=local,src=/tmp/build-cache/arm64 \ - --tag ${{ steps.formatted-image_id.outputs.IMAGE_ID }}:${{ steps.formatted_version.outputs.VERSION }} \ - --tag ${{ steps.formatted-image_id.outputs.IMAGE_ID }}:${{ needs.version.outputs.pypi_version }} \ - --label "runnumber=${GITHUB_RUN_ID}" \ - docker/ \ No newline at end of file + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ steps.formatted-image_id.outputs.IMAGE_ID }} + labels: | + runnumber=${GITHUB_RUN_ID} + tags: | + type=raw,value=${{ steps.formatted_version.outputs.VERSION }} + type=raw,value=${{ needs.version.outputs.pypi_version }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + context: "{{defaultContext}}:docker" + cache-from: | + type=local,src=/tmp/build-cache/amd64 + type=local,src=/tmp/build-cache/arm64