diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cd75fe..be1561e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,10 @@ name: CI on: push: +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: maven: runs-on: ubuntu-latest @@ -38,9 +42,15 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + # https://github.com/docker/metadata-action (lower cases image name, etc.) + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push uses: docker/build-push-action@v2 with: - push: true - tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }} \ No newline at end of file + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}