-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.72 KB
/
build-dependency.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Reusable dependency workflow
on:
workflow_call:
inputs:
build-tag:
type: string
required: true
target-platform:
type: string
required: true
target-archs:
type: string
required: true
dependency:
type: string
required: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
env:
BUILD_TAG: ${{ inputs.build-tag }}
TARGET_PLATFORM: ${{ inputs.target-platform }}
TARGET_ARCHS: ${{ inputs.target-archs }}
DEPENDENCY: ${{ inputs.dependency }}
steps:
- uses: actions/checkout@v3
name: Checkout
- uses: docker/setup-qemu-action@v2
name: Setup QEMU
- uses: docker/setup-buildx-action@v2
name: Setup Docker Buildx
- uses: docker/login-action@v2
name: Login to GitHub Container Registry
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v3
name: Build Docker image
with:
context: platforms/${{ env.TARGET_PLATFORM }}/dependencies/${{ env.DEPENDENCY }}
platforms: ${{ env.TARGET_ARCHS }}
build-args: |
IMAGE_PREFIX=ghcr.io/${{ github.repository }}/${{ env.TARGET_PLATFORM }}/
TAG=${{ env.BUILD_TAG }}
push: true
tags: ghcr.io/${{ github.repository }}/${{ env.TARGET_PLATFORM }}/${{ env.DEPENDENCY }}:${{ env.BUILD_TAG }}
cache-from: type=gha,scope=${{ env.TARGET_PLATFORM }}-${{ env.DEPENDENCY }}-${{ env.BUILD_TAG }}
cache-to: type=gha,mode=max,scope=${{ env.TARGET_PLATFORM }}-${{ env.DEPENDENCY }}-${{ env.BUILD_TAG }}