diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index d88bb631dae..00000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: Retag and Push Docker Image on Release - -on: - release: - types: [published] - -jobs: - retag-and-push: - runs-on: ubuntu-latest - - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Pull Docker image with commit tag - run: docker pull mozilla/blurts-server:${{ github.event.release.target_commitish }} - - - name: Tag Docker image with release tag - run: docker tag mozilla/blurts-server:${{ github.event.release.target_commitish }} mozilla/blurts-server:${{ github.event.release.tag_name }} - - - name: Push Docker image with release tag - run: docker push mozilla/blurts-server:${{ github.event.release.tag_name }} diff --git a/.github/workflows/release_retag.yaml b/.github/workflows/release_retag.yaml new file mode 100644 index 00000000000..a9b6d38b2ae --- /dev/null +++ b/.github/workflows/release_retag.yaml @@ -0,0 +1,36 @@ +name: Retag and Push Docker Image on Release +# GH release should always create a tag automatically +on: + push: + tags: + - '*' + +jobs: + retag-and-push: + runs-on: ubuntu-latest + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: mozilla/blurts-server + tags: type=sha,format=short,prefix= + + - name: Pull Docker image with commit tag + run: docker pull ${{ steps.meta.outputs.tags }} + + - name: Tag Docker image with release tag + run: docker tag ${{ steps.meta.outputs.tags }} mozilla/blurts-server:${{ github.ref_name }} + + - name: Push Docker image with release tag + run: docker push mozilla/blurts-server:${{ github.ref_name }}