blob: ad4a1eb2d92004ad9ae7e3ad1c3a6c4fa0e99c06 (
plain)
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
|
name: Banner Container (Rust)
on:
push:
tags:
- 'v/**'
branches:
- main
- main-next
workflow_dispatch:
env:
IMAGE_NAME: banner-rs
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
jobs:
build-and-push:
name: Build and push image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install QEMU dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Determine tags
id: tags
run: |
TAGS="${{ github.sha }}"
if [[ "${{ github.ref }}" == refs/tags/v/* ]]; then
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v/}"
TAGS="${VERSION} latest ${TAGS}"
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "Generated tags: ${TAGS}"
- name: Build image
id: build_image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ steps.tags.outputs.tags }}
archs: amd64, arm64, arm/v7
containerfiles: |
./Containerfile
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.description=Banner server
org.opencontainers.image.licenses=MIT
- name: Push to GHCR
uses: redhat-actions/push-to-registry@v2
id: push
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Echo outputs
run: |
echo "${{ toJSON(steps.push.outputs) }}"
|