Also build arm64 standalone package when releasing #195
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: Build Docker Images | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v*" | |
#pull_request: | |
# branches: | |
# - "**" | |
workflow_dispatch: | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- name: Build binaries | |
run: | | |
build/build.sh | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Commit any updated files | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "[skip ci] Commit changes from build-dockers action" | |
commit_options: "-S" | |
commit_user_email: ${{ vars.COMMIT_USER }} | |
- name: Cache build output | |
uses: actions/cache/save@v4 | |
with: | |
path: build | |
key: build-dockers-${{ github.sha }} | |
build-publish: | |
runs-on: ubuntu-latest | |
needs: prepare | |
strategy: | |
matrix: | |
include: | |
- image: ghcr.io/hakwerk/labca-gui | |
dockerfile: build/Dockerfile-gui | |
label: org.opencontainers.image.title=labca-gui | |
- image: ghcr.io/hakwerk/labca-boulder | |
dockerfile: build/Dockerfile-boulder | |
label: org.opencontainers.image.title=labca-boulder | |
- image: ghcr.io/hakwerk/labca-control | |
dockerfile: build/Dockerfile-control | |
label: org.opencontainers.image.title=labca-control | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Restore build output | |
uses: actions/cache/restore@v4 | |
with: | |
path: build | |
key: build-dockers-${{ github.sha }} | |
- name: Set up docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ matrix.image }} | |
labels: ${{ matrix.label }} | |
tags: | | |
type=schedule,pattern={{date 'YYYYMMDD'}} | |
type=match,pattern=v(.*),group=1 | |
type=edge,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
type=ref,event=branch,enable=${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} | |
type=ref,event=pr | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.ACTION_PAT }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: build | |
file: ${{ matrix.dockerfile }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |