Add caching + don't push :latest tag on feature branches #48
This file contains 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: depot-build-and-push | |
on: push | |
jobs: | |
docker: | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: depot/setup-action@v1 | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push with sha + latest tag on master | |
if: github.ref == 'refs/heads/master' | |
uses: depot/build-push-action@v1 | |
with: | |
project: b4qlt63xvg | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
reclaimthestack/rails-example:latest | |
reclaimthestack/rails-example:sha-${{ github.sha }} | |
- name: Build and push with sha tag on feature branches | |
if: github.ref != 'refs/heads/master' | |
uses: depot/build-push-action@v1 | |
with: | |
project: b4qlt63xvg | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
reclaimthestack/rails-example:sha-${{ github.sha }} |