-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (51 loc) · 1.52 KB
/
build.yaml
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
name: build
on:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository }}/__service__
- uses: int128/docker-build-cache-config-action@v1
id: cache
with:
image: ghcr.io/${{ github.repository }}/cache
flavor: prefix=__service__--
- uses: docker/setup-buildx-action@v3
- uses: docker/bake-action@v5
id: bake
with:
push: true
files: |
./docker-bake.hcl
${{ steps.metadata.outputs.bake-file }}
${{ steps.cache.outputs.bake-file }}
- uses: actions/github-script@v7
env:
bake_metadata: ${{ steps.bake.outputs.metadata }}
with:
script: |
const metadata = JSON.parse(process.env.bake_metadata)
const services = Object.keys(metadata)
for (const service of services) {
const digest = metadata[service]['containerimage.digest']
const image = metadata[service]['image.name']
const uri = `${image}@${digest}`
core.info(`${service}=${uri}`)
}