Release Action (automated) #253
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Action (automated) | |
| on: | |
| workflow_run: | |
| workflows: [CI] | |
| types: [completed] | |
| branches: [main] | |
| concurrency: | |
| group: release | |
| jobs: | |
| push-to-registry: | |
| name: Push Docker image to Docker Hub | |
| runs-on: ubuntu-latest | |
| # Check if the tests were successful and were launched by a push event | |
| if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ewjoachim | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| # See Dockerfile.build for instructions on bumping this. | |
| tags: | | |
| ewjoachim/python-coverage-comment-action-base:v6 | |
| ghcr.io/py-cov-action/python-coverage-comment-action-base:v6 | |
| push: true | |
| file: Dockerfile.build | |
| platforms: linux/amd64,linux/arm64 | |
| compute-tags: | |
| name: Re-tag action with new version | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Apply new tags | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -eux | |
| current="$(git describe --tags --abbrev=0 --match 'v*.*')" | |
| major="$(echo $current | cut -d. -f1)" | |
| minor="$(echo $current | cut -d. -f2)" | |
| git tag -f ${major} | |
| git push -f origin ${major} |