mirror of
https://github.com/m1k1o/neko.git
synced 2026-11-03 00:11:48 -06:00
DRY workflows.
This commit is contained in:
@@ -5,69 +5,16 @@ on:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
# Prefix for the image name.
|
||||
FLAVOR_PREFIX: "intel-"
|
||||
# Will be used in the Dockerfile generation script.
|
||||
RUNTIME_DOCKERFILE: Dockerfile.intel
|
||||
# The platforms to build for.
|
||||
PLATFORMS: linux/amd64
|
||||
|
||||
jobs:
|
||||
build-base:
|
||||
name: Build base image
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha,format=long
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Generate base Dockerfile
|
||||
run: go run docker/main.go -i Dockerfile.tmpl -o Dockerfile
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
uses: ./.github/workflows/image_base.yml
|
||||
with:
|
||||
flavor: intel
|
||||
platforms: linux/amd64
|
||||
dockerfile: Dockerfile.intel
|
||||
|
||||
build-apps:
|
||||
name: Build application images
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
uses: ./.github/workflows/image_app.yml
|
||||
needs: [ build-base ]
|
||||
strategy:
|
||||
# Will build all images even if some fail.
|
||||
@@ -87,44 +34,8 @@ jobs:
|
||||
- name: vlc
|
||||
- name: xfce
|
||||
- name: kde
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}${{ matrix.name }}
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha,format=long
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: apps/${{ matrix.name }}
|
||||
file: apps/${{ matrix.name }}/${ matrix.dockerfile || 'Dockerfile' }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
BASE_IMAGE=ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base:sha-${{ github.sha }}
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
with:
|
||||
name: ${{ matrix.name }}
|
||||
dockerfile: ${{ matrix.dockerfile }}
|
||||
flavor: intel
|
||||
platforms: linux/amd64
|
||||
|
||||
Reference in New Issue
Block a user