-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (123 loc) Β· 3.96 KB
/
publish.yaml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
---
name: publish
on:
schedule:
- cron: '0 10 * * *' # everyday at 10am
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE_PATH: ${{ vars.REGISTRY_URI }}/${{ vars.REGISTRY_REPOSITORY }}/ee-kube-hub-init-tools
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
# Modified from: https://github.com/redhat-actions/buildah-build/issues/121#issuecomment-1683691170
jobs:
build-ee:
name: Build EE
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout ποΈ
uses: actions/checkout@v4
- name: Install ansible-builder π§°
run: pip install ansible-builder
- name: Crate Ansible EE container image context π
run: ansible-builder create -v3
- name: Extract architecture name from platform name π
run: |
echo "PODMAN_ARCH=${PLATFORM#*/}" >>${GITHUB_ENV}
env:
PLATFORM: ${{ matrix.platform }}
- name: Create container image build meta βΉοΈ
id: build-meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_PATH }}
tags: |
type=raw,value=build
flavor: |
suffix=-${{ env.PODMAN_ARCH }}
- name: Set up QEMU π§°
uses: docker/setup-qemu-action@v3
- name: Build OCI Image π οΈ
id: build-image
uses: redhat-actions/buildah-build@v2
with:
tags: ${{ steps.build-meta.outputs.tags }}
labels: ${{ steps.build-meta.outputs.labels }}
oci: true
context: ./context
containerfiles: |
./context/Containerfile
platforms: ${{ matrix.platform }}
- name: Export OCI archives πΎ
run: skopeo copy containers-storage:${{ env.IMAGE_PATH }}:build-${{ env.PODMAN_ARCH }} oci-archive:/tmp/${{ env.PODMAN_ARCH }}-oci.tar
- name: Upload OCI archives πΊ
uses: actions/upload-artifact@v4
with:
name: build-${{ env.PODMAN_ARCH }}
path: /tmp/${{ env.PODMAN_ARCH }}-oci.tar
if-no-files-found: error
retention-days: 1
publish-ee:
name: Publish EE
runs-on: ubuntu-latest
needs: build-ee
steps:
- name: Download OCI archives π»
uses: actions/download-artifact@v4
with:
pattern: build-*
path: oci-archives
merge-multiple: true
- name: Create manifest π
run: podman manifest create ${{ env.IMAGE_PATH }}:manifest
- name: Add platform specific images to manifest β
run: |
for OCI_TAR in oci-archives/*-oci.tar; do
podman manifest add ${{ env.IMAGE_PATH }}:manifest oci-archive:${OCI_TAR}
done
- name: Create container image build meta βΉοΈ
id: push-meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_PATH }}
tags: |
type=schedule,pattern=nightly
type=edge,branch=main
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Tag multi platform manifest π·
run: |
podman tag ${{ env.IMAGE_PATH }}:manifest $(echo "${{ steps.push-meta.outputs.tags }}" | tr '\n' ' ')
- name: Publish images π°
id: publish-images
uses: redhat-actions/push-to-registry@v2
with:
tags: ${{ steps.push-meta.outputs.tags }}
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Pushed Image Digest π
run: echo ${{ steps.publish-images.outputs.digest }}
- name: Pushed Image Registry Paths π
run: echo ${{ steps.publish-images.outputs.registry-paths }}