-
Notifications
You must be signed in to change notification settings - Fork 10
74 lines (65 loc) · 2.2 KB
/
build_containers.yml
File metadata and controls
74 lines (65 loc) · 2.2 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
---
name: Build container images
on:
push:
pull_request:
branches: [develop]
merge_group:
jobs:
build_containers:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Set Registry
run: |
#!/bin/bash
echo IMAGE_REPOSITORY="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
if [ "${{ github.server_url }}" = "https://codeberg.org" ]; then
echo "REGISTRY=codeberg.org" >> "$GITHUB_ENV"
echo "REGISTRY_TOKEN=${{ secrets.REGISTRY_TOKEN }}" >> "$GITHUB_ENV"
else
echo "REGISTRY=ghcr.io" >> "$GITHUB_ENV"
echo "REGISTRY_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV"
fi
- name: Login to Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3.7.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ env.REGISTRY_TOKEN }}
- name: Checkout Repository
uses: actions/checkout@v6.0.2
with:
path: Sample-Server
submodules: recursive
persist-credentials: false
- name: Set up QEMU
uses: docker/setup-qemu-action@v4.0.0
- name: Set up Buildx
uses: docker/setup-buildx-action@v3.12.0
- name: Get Container Meta Data
uses: docker/metadata-action@v5.10.0
id: docker_meta
with:
images: "${{ env.REGISTRY }}/${{ env.IMAGE_REPOSITORY }}"
flavor: |
latest=true
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
- name: Build and push
uses: docker/build-push-action@v6.19.2
with:
provenance: false
file: "./Sample-Server/Dockerfile"
context: ./Sample-Server
platforms: linux/amd64, linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
VERSION=${{ steps.docker_meta.outputs.version }}