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 build and publish | |
on: | |
push: | |
branches: [ "main", "dev" ] | |
tags: [ 'v*' ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
REGISTRY: ghcr.io | |
REPO: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install just | |
uses: extractions/setup-just@v1 | |
with: | |
just-version: 1.33.0 | |
- name: Docker build and publish ${{ env.REGISTRY }}:${{ env.REPO }} | |
if: github.event_name != 'pull_request' | |
run: just docker-ci "${REGISTRY}/${REPO}" | |
- name: Docker build (PR validate) | |
if: github.event_name == 'pull_request' | |
run: just docker-build |