From 1d654661e30c0174ecbd7dc080761b6828452efa Mon Sep 17 00:00:00 2001 From: Gustavo Date: Wed, 3 Jul 2024 12:20:58 -0600 Subject: [PATCH] chore: build with correct ref Signed-off-by: Gustavo --- .github/workflows/docker.yml | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5f23475..7de9b00 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,10 +1,10 @@ name: docker -on: +on: push: branches: - main tags: - - '*' + - "*" env: REGISTRY: ghcr.io/${{ github.repository_owner }} @@ -21,15 +21,26 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Get tag - id: get-tag - run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/} + - name: Docker meta + id: meta + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5 + with: + # list of Docker images to use as base name for tags + images: | + ${{ env.REGISTRY }}/elric-rs + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=semver,pattern={{major}} + type=sha + - name: Build and push uses: docker/build-push-action@v4 with: - build-args: | - TARGET=${{ matrix.contract }} push: true - tags: | - ${{ env.REGISTRY }}/elric-rs:latest - ${{ env.REGISTRY }}/elric-rs:${{ steps.get-tag.outputs.short_ref }} + tags: ${{ steps.meta.outputs.tags }}