-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (61 loc) · 1.91 KB
/
container-publish.yml
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
name: Build & publish container
on:
push:
branches: [ main ]
workflow_dispatch: {}
concurrency: build
env:
CI_TOOLS_SETUP: https://raw.githubusercontent.com/SGSGermany/ci-tools/main/setup.sh
defaults:
run:
shell: bash -eu -o pipefail {0}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
BASE_IMAGE:
- docker.io/alpine:3.17
- docker.io/alpine:3.18
- docker.io/alpine:3.19
- docker.io/alpine:3.20
env:
REGISTRY: ghcr.io
OWNER: sgsgermany
IMAGE: alpine
BASE_IMAGE: ${{ matrix.BASE_IMAGE }}
steps:
- name: Setup CI tools
run: |
. <(curl -fsS -L "$CI_TOOLS_SETUP" | bash -s ~/ci-tools)
echo "CI_TOOLS=$CI_TOOLS" | tee -a "$GITHUB_ENV"
echo "CI_TOOLS_PATH=$CI_TOOLS_PATH" | tee -a "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@v3
- name: Log into container registry ${{ env.REGISTRY }}
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate container image tags
run: |
source <(./tags.sh "$GITHUB_RUN_ID.$GITHUB_RUN_NUMBER")
echo "MILESTONE=$MILESTONE" | tee -a "$GITHUB_ENV"
echo "VERSION=$VERSION" | tee -a "$GITHUB_ENV"
echo "TAGS=$TAGS" | tee -a "$GITHUB_ENV"
- name: Build container image
run: |
buildah unshare ./build.sh
- name: Container image metadata
run: |
podman image inspect "localhost/$IMAGE:${TAGS%% *}"
- name: Push container image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.IMAGE }}
registry: ${{ env.REGISTRY }}/${{ env.OWNER }}
tags: ${{ env.TAGS }}