From 858ba19670ac54db90349192cbd97746457177eb Mon Sep 17 00:00:00 2001 From: Andy Hsu Date: Wed, 21 Feb 2024 14:58:45 +0800 Subject: [PATCH] ci: also push docker to hub for pr --- .github/workflows/build_docker.yml | 5 ++--- .github/workflows/del-pr-docker.yml | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/del-pr-docker.yml diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 3a63630d..989fcd75 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -38,7 +38,6 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - if: github.event_name == 'push' uses: docker/login-action@v3 with: username: xhofe @@ -50,7 +49,7 @@ jobs: with: context: . file: Dockerfile.ci - push: ${{ github.event_name == 'push' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x @@ -69,7 +68,7 @@ jobs: uses: docker/build-push-action@v5 with: file: Dockerfile.ffmpeg - push: ${{ github.event_name == 'push' }} + push: true tags: ${{ steps.meta-ffmpeg.outputs.tags }} labels: ${{ steps.meta-ffmpeg.outputs.labels }} platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x diff --git a/.github/workflows/del-pr-docker.yml b/.github/workflows/del-pr-docker.yml new file mode 100644 index 00000000..82ae69cf --- /dev/null +++ b/.github/workflows/del-pr-docker.yml @@ -0,0 +1,24 @@ +name: delete closed pr docker tag + +on: + pull_request: + types: [closed] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + del_docker_tag: + name: Build Docker + runs-on: ubuntu-latest + steps: + + - name: Delete docker tag + id: del_docker_tag + uses: xhofe/del-docker-tag@main + with: + username: xhofe + password: ${{ secrets.DOCKERHUB_TOKEN }} + # token: ${{ secrets.DOCKER_TOKEN }} + tags: xhofe/alist:pr-${{ github.event.pull_request.number }},xhofe/alist:pr-${{ github.event.pull_request.number }}-ffmpeg \ No newline at end of file