Repository navigation
88 lines (74 loc) · 2.46 KB
/
Copy pathnightly-build.yml
File metadata and controls
88 lines (74 loc) · 2.46 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
87
88
name: Nightly Build and Push
on:
schedule:
- cron: '0 0 * * *' # Runs at 00:00 UTC every day
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
BUNDLE_IMAGE_NAME: ${{ github.repository }}-bundle
jobs:
build-push:
name: Build and Push Multi-Arch Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache
df -h
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
run: |
GIT_SHA=$(git rev-parse --short HEAD)
BUILD_TIMESTAMP=$(date +"%Y%m%d%H%M%S")
echo "git_sha=${GIT_SHA}" >> $GITHUB_OUTPUT
echo "build_timestamp=${BUILD_TIMESTAMP}" >> $GITHUB_OUTPUT
- name: Build and push image
id: build
uses: docker/build-push-action@v7
with:
context: .
target: prod
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main
labels: |
org.opencontainers.image.revision=${{ steps.meta.outputs.git_sha }}
org.opencontainers.image.created=${{ steps.meta.outputs.build_timestamp }}
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
- name: Generate bundle manifests
run: |
make bundle \
IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }} \
VERSION=0.0.0-main-${{ steps.meta.outputs.git_sha }} \
USE_IMAGE_DIGESTS=true
- name: Build and push bundle image
uses: docker/build-push-action@v7
with:
context: .
file: bundle.Dockerfile
platforms: linux/amd64
push: true
tags: ${{ env.REGISTRY }}/${{ env.BUNDLE_IMAGE_NAME }}:main