diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index f58856f..0abfddb 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -10,7 +10,7 @@ on: # and a name for the Docker image that this workflow builds. env: REGISTRY: git.housh.dev - IMAGE_NAME: swift-dev + IMAGE_NAME: ${{ gitea.repository }} # There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. jobs: @@ -37,6 +37,18 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels + # that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a + # subsequent step. The `images` value provides the base name for the tags and labels. + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=sha + type=raw,value=latest - name: Build and push Docker image id: push uses: docker/build-push-action@v6 @@ -44,4 +56,5 @@ jobs: context: . file: Dockerfile push: true - tags: michael/swift-dev:latest + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}