diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 214dd96..97d927a 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -2,16 +2,15 @@ name: Docker Image CI on: push: - branches: - - main + branches: [ "main" ] paths: - '**' - '!example/**' - '!README.md' - '!LICENSE' - # Publish semver tags as releases. - tags: [ 'v*' ] + tags: ['v*'] pull_request: + branches: [ "main" ] workflow_dispatch: jobs: @@ -19,11 +18,24 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + name: Set up QEMU + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} + flavor: | + latest=true + tags: | + type=sha + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr - name: Login to DockerHub uses: docker/login-action@v3 @@ -36,4 +48,5 @@ jobs: uses: docker/build-push-action@v5 with: push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}