From 96fe6da681ad0d5e1a0930216c4b66d2e717b768 Mon Sep 17 00:00:00 2001 From: Adam Sven Johnson Date: Thu, 4 May 2023 09:48:46 +1200 Subject: [PATCH] Update image action to add labels - Updated actions to latest versions - Made steps mirror the examples order - Added permissions - Added labels to image push - I think this will include it on the packages page --- .github/workflows/docker.yml | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cf0f3b2e..6a7f8063 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,9 +4,13 @@ on: tags: - 'v*.*.*' jobs: - push_to_registry: + push-to-ghcr: name: Push Docker image to Docker Hub runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: - name: Check out the repo uses: actions/checkout@v3 @@ -14,25 +18,26 @@ jobs: - name: Set BRAMBLE_VERSION env run: echo "BRAMBLE_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV - - name: Docker meta - id: docker_meta - uses: docker/metadata-action@v3 - with: - images: ghcr.io/movio/bramble - - - name: Login to GH Container Registry - uses: docker/login-action@v1 + - name: Login to ghcr.io + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_ACCESS_TOKEN }} - - name: Push to GH Container Registry - uses: docker/build-push-action@v2 + - name: Extract metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/movio/bramble + + - name: Push to ghcr.io + uses: docker/build-push-action@v4 with: context: . registry: ghcr.io push: true build-args: | VERSION=${{ env.BRAMBLE_VERSION }} - tags: ${{ steps.docker_meta.outputs.tags }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}