diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f72285aad..dfcc541d3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,8 +5,13 @@ on: - dev - beta - stable - - docker_publish - workflow_dispatch: + tags: + - '*' + pull_request: + branches: + - dev + - beta + - stable jobs: publish: runs-on: ubuntu-latest @@ -18,8 +23,10 @@ jobs: images: | pwntools/pwntools tags: | - # branch event type=ref,event=branch + type=ref,event=pr + type=pep440,pattern={{version}} + type=raw,value=latest,enable={{is_default_branch}} # Required for subdirectories in Git context - name: Set up Docker Buildx @@ -33,40 +40,44 @@ jobs: - name: Build and push base image uses: docker/build-push-action@v4 - if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/dev')) + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/dev') with: context: "{{defaultContext}}:extra/docker/base" push: ${{ github.event_name != 'pull_request' }} - tags: peacemakerdev/pwntools:base + tags: pwntools/pwntools:base - name: Build and push stable image uses: docker/build-push-action@v4 - if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/stable')) + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/stable') with: context: "{{defaultContext}}:extra/docker/stable" push: ${{ github.event_name != 'pull_request' }} - tags: pwntools/pwntools:stable + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - name: Build and push beta image uses: docker/build-push-action@v4 - if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/beta')) + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/beta') with: context: "{{defaultContext}}:extra/docker/beta" push: ${{ github.event_name != 'pull_request' }} - tags: pwntools/pwntools:beta + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - name: Build and push dev image uses: docker/build-push-action@v4 - if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/dev')) + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/dev') with: context: "{{defaultContext}}:extra/docker/dev" push: ${{ github.event_name != 'pull_request' }} - tags: pwntools/pwntools:dev + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - name: Build and push ci image uses: docker/build-push-action@v4 - if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/dev')) + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/dev') with: context: "{{defaultContext}}:travis/docker" push: ${{ github.event_name != 'pull_request' }} tags: pwntools/pwntools:ci + labels: ${{ steps.meta.outputs.labels }}