-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (84 loc) · 3.12 KB
/
build.yml
File metadata and controls
86 lines (84 loc) · 3.12 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Build
on:
push:
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
arch: [ amd64, arm64 ]
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-latest-arm' || 'ubuntu-latest' }}
defaults:
run:
shell: bash
steps:
- uses: gardenlinux/workflow-telemetry-action@v2
with:
metric_frequency: 1
comment_on_pr: false
- uses: actions/checkout@v6.0.0
- uses: ./.github/actions/setup
with:
arch: ${{ matrix.arch }}
- name: build builder container images
run: |
podman build --squash-all --arch ${{ matrix.arch }} --tag ghcr.io/${{ github.repository }}:${{ matrix.arch }}-${{ github.sha }} .
- name: publish arch specific builder container image
if: github.ref == 'refs/heads/main'
run: |
podman login -u token -p ${{ github.token }} ghcr.io
podman push ghcr.io/${{ github.repository }}:${{ matrix.arch }}-${{ github.sha }}
push:
runs-on: ubuntu-latest
needs: build
defaults:
run:
shell: bash
steps:
- uses: gardenlinux/workflow-telemetry-action@v2
with:
metric_frequency: 1
comment_on_pr: false
- uses: actions/checkout@v6.0.0
- name: publish builder container images
if: github.ref == 'refs/heads/main'
run: |
podman login -u token -p ${{ github.token }} ghcr.io
podman manifest create ghcr.io/${{ github.repository }}:${{ github.sha }}
podman manifest add ghcr.io/${{ github.repository }}:${{ github.sha }} ghcr.io/${{ github.repository }}:amd64-${{ github.sha }}
podman manifest add ghcr.io/${{ github.repository }}:${{ github.sha }} ghcr.io/${{ github.repository }}:arm64-${{ github.sha }}
podman push ghcr.io/${{ github.repository }}:${{ github.sha }}
sed -i 's|container_image=localhost/builder|container_image=ghcr.io/${{ github.repository }}:${{ github.sha }}|' build
- uses: actions/upload-artifact@v5
with:
name: build
path: build
- uses: actions/upload-artifact@v5
with:
name: build.config
path: build.config
# Run for new commits on the main branch
release-latest:
runs-on: ubuntu-latest
needs: push
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v6.0.0
- name: tag latest
run: |
git tag --force latest
git push --force origin latest
- uses: actions/download-artifact@v6
with:
name: build
path: download
- uses: actions/download-artifact@v6
with:
name: build.config
path: download
- name: create release
run: |
release="$(.github/workflows/release.sh ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} create latest "Builder (latest)")"
.github/workflows/release.sh ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} upload "$release" download/build
.github/workflows/release.sh ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} upload "$release" download/build.config