diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 10bf532..f53dc11 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -1,8 +1,11 @@ name: CICD on: + push: + branches: ["**"] + tags: ["*.*.*"] release: - types: [published, prereleased] + types: [created] env: REGISTRY: ghcr.io @@ -25,6 +28,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + # replaces slashes with dashes in platform name - name: Convert platform pairs run: | platform=${{ matrix.platform }} @@ -34,6 +38,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} @@ -53,7 +58,7 @@ jobs: context: . platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} - outputs: type=image,name=${{ env.REGISTRY }}/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true + outputs: type=image,name=${{ env.REGISTRY }}/${{ github.repository }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }} - name: Export digest run: | @@ -71,6 +76,7 @@ jobs: merge: runs-on: ubuntu-latest + if: ${{ github.event_name != 'pull_request' }} needs: - build steps: @@ -90,10 +96,14 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ github.repository }} tags: | + type=ref,event=branch type=ref,event=tag + type=ref,event=pr + type=sha type=semver,pattern={{version}} - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} @@ -108,4 +118,4 @@ jobs: - name: Inspect image run: | - docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository }}:${{ steps.meta.outputs.version }} \ No newline at end of file + docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository }}:${{ steps.meta.outputs.version }}