This repository has been archived by the owner on Feb 3, 2024. It is now read-only.
Update build-docker.yml #2
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: Docker | |
on: | |
push: | |
paths-ignore: | |
- "README.md" | |
branches: | |
- master | |
- guest_accounts # Since this is the branch we actually want | |
jobs: | |
tests: | |
uses: ./.github/workflows/run-tests.yml | |
build: | |
name: Build Docker image and push to registry | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
if: github.event_name != 'pull_request' | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: Entepotenz/change-string-case-action-min-dependencies@v1 # https://github.com/orgs/community/discussions/10553 | |
id: repo-uri-string | |
with: | |
string: ghcr.io/${{ github.repository }} | |
- uses: docker/metadata-action@v5 | |
id: docker-meta # used in next step | |
with: | |
images: ${{ steps.repo-uri-string.outputs.lowercase }} | |
tags: | | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha | |
- uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.docker-meta.outputs.tags }} | |
labels: ${{ steps.docker-meta.outputs.labels }} | |
# Some basic caching of the layers... | |
cache-from: ${{ steps.repo-uri-string.outputs.lowercase }}:latest-cache | |
cache-to: ${{ steps.repo-uri-string.outputs.lowercase }}:latest-cache |