Skip to content

Build

Build #154

Workflow file for this run

name: Build
on:
schedule:
- cron: "0 5 * * 1"
workflow_call:
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build-image:
name: Build images and push to registry
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Create new buildx builder
uses: docker/setup-buildx-action@v3
- name: Generate app image tags
uses: docker/metadata-action@v5
id: meta-app
with:
bake-target: app-production
images: |
ghcr.io/${{ github.repository }}-app
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
- name: Generate web image tags
uses: docker/metadata-action@v5
id: meta-web
with:
bake-target: web-production
images: |
ghcr.io/${{ github.repository }}-web
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
- name: Generate ns8 image tags
uses: docker/metadata-action@v5
id: meta-ns8
with:
bake-target: ns8
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/bake-action@v5.8.0
with:
targets: deploy
files: |
./docker-bake.hcl
${{ steps.meta-app.outputs.bake-file }}
${{ steps.meta-web.outputs.bake-file }}
${{ steps.meta-ns8.outputs.bake-file }}
set: |
*.cache-to=type=gha,mode=max
*.cache-from=type=gha
push: true