This repository was archived by the owner on Jun 18, 2025. It is now read-only.
Merge pull request #427 from sanger/dependabot/bundler/rack-2.2.13 #259
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: Build and publish Docker image | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - master | |
| tags: | |
| - release-* | |
| - uat-* | |
| - dev-* | |
| env: | |
| IMAGE_NAME: ${{ github.repository }}/${{ github.event.repository.name }} | |
| jobs: | |
| build_and_publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: env | |
| - uses: actions/checkout@v1 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: /var/lib/docker | |
| key: ${{ runner.os }}-docker-${{ hashFiles('Dockerfile') }} | |
| restore-keys: | | |
| ${{ runner.os }}-docker-${{ hashFiles('Dockerfile') }} | |
| - name: Build and tag the Docker image | |
| run: docker build . --file Dockerfile --tag docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/} | |
| - name: Tag (latest) the Docker image | |
| run: docker tag docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/} docker.pkg.github.com/${IMAGE_NAME}:latest | |
| if: github.ref == 'refs/heads/master' | |
| - name: Login to registry | |
| run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} docker.pkg.github.com | |
| - name: Publish image | |
| run: docker push docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/} | |
| - name: Publish image (latest) | |
| run: docker push docker.pkg.github.com/${IMAGE_NAME}:latest | |
| if: github.ref == 'refs/heads/master' | |
| # - name: Remove old releases | |
| # uses: snok/container-retention-policy@v2 | |
| # with: | |
| # image-names: ${{ github.event.repository.name }}/* | |
| # cut-off: Ten months ago UTC | |
| # timestamp-to-use: updated_at | |
| # account-type: org | |
| # org-name: sanger | |
| # keep-at-least: 5 | |
| # skip-tags: latest | |
| # token: ${{ secrets.REMOVE_OLD_IMAGES }} |