This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
forked from gardenlinux/gardenlinux
-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (148 loc) · 8.59 KB
/
publish_container.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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: publish gardenlinux container images
on:
workflow_call:
inputs:
version:
type: string
default: now
jobs:
publish_container:
name: publish gardenlinux container base image
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # [email protected]
- uses: ./.github/actions/setup
- name: set VERSION=${{ inputs.version }}
run: |
bin/garden-version "${{ inputs.version }}" | tee VERSION
git update-index --assume-unchanged VERSION
- name: get cname
run: |
cname_amd64="$(./build --resolve-cname container-amd64)"
cname_arm64="$(./build --resolve-cname container-arm64)"
echo "cname_amd64=$cname_amd64" | tee -a "$GITHUB_ENV"
echo "cname_arm64=$cname_arm64" | tee -a "$GITHUB_ENV"
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # pin@v3
with:
name: ${{ env.cname_amd64 }}
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # pin@v3
with:
name: ${{ env.cname_arm64 }}
- name: publish gardenlinux container base image
run: |
version=$(bin/garden-version "${{ inputs.version }}")
podman login -u token -p ${{ github.token }} ghcr.io
tar xzv < "${{ env.cname_amd64 }}.tar.gz"
image="$(podman load < ${{ env.cname_amd64 }}.oci | awk '{ print $NF }')"
# Tagging for amd64 nightly
podman tag "$image" ghcr.io/${{ github.repository }}:amd64-nightly
podman push ghcr.io/${{ github.repository }}:amd64-nightly
# Tagging for amd64 with version
podman tag "$image" ghcr.io/${{ github.repository }}:amd64-${version}
podman push ghcr.io/${{ github.repository }}:amd64-${version}
tar xzv < "${{ env.cname_arm64 }}.tar.gz"
image="$(podman load < ${{ env.cname_arm64 }}.oci | awk '{ print $NF }')"
# Tagging for arm64 nightly
podman tag "$image" ghcr.io/${{ github.repository }}:arm64-nightly
podman push ghcr.io/${{ github.repository }}:arm64-nightly
# Tagging for arm64 with version
podman tag "$image" ghcr.io/${{ github.repository }}:arm64-${version}
podman push ghcr.io/${{ github.repository }}:arm64-${version}
# Creating and pushing manifest for nightly
podman manifest create ghcr.io/${{ github.repository }}:nightly
podman manifest add ghcr.io/${{ github.repository }}:nightly ghcr.io/${{ github.repository }}:amd64-nightly
podman manifest add ghcr.io/${{ github.repository }}:nightly ghcr.io/${{ github.repository }}:arm64-nightly
podman push ghcr.io/${{ github.repository }}:nightly
# Creating and pushing manifest for version tag
podman manifest create ghcr.io/${{ github.repository }}:${version}
podman manifest add ghcr.io/${{ github.repository }}:${version} ghcr.io/${{ github.repository }}:amd64-${version}
podman manifest add ghcr.io/${{ github.repository }}:${version} ghcr.io/${{ github.repository }}:arm64-${version}
podman push ghcr.io/${{ github.repository }}:${version}
publish_kmodbuild_container:
name: publish gardenlinux kernel module build dev image
runs-on: ubuntu-latest
needs: publish_container
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # [email protected]
- uses: ./.github/actions/setup
- name: get container versions
id: versions
run: |
version="$(bin/garden-version "${{ inputs.version }}")"
snapshot="$(gh api "/repos/gardenlinux/repo/contents/.container?ref=$version" | jq -r '.content' | base64 -d)"
echo -e "base=ghcr.io/${{ github.repository }}:$version\nsnapshot=$snapshot" | tee "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
- name: publish gardenlinux kernel module build dev image
run: |
version=$(bin/garden-version "${{ inputs.version }}")
podman login -u token -p ${{ github.token }} ghcr.io
base='${{ steps.versions.outputs.base }}'
snapshot='${{ steps.versions.outputs.snapshot }}'
podman pull --arch amd64 "$base"
podman pull --arch amd64 "$snapshot"
podman build --arch amd64 --build-arg base="$base" --build-arg snapshot="$snapshot" -t ghcr.io/${{ github.repository }}/kmodbuild:amd64-${version} container/kmodbuild
podman push ghcr.io/${{ github.repository }}/kmodbuild:amd64-${version}
podman pull --arch arm64 "$base"
podman pull --arch arm64 "$snapshot"
podman build --arch arm64 --build-arg base="$base" --build-arg snapshot="$snapshot" -t ghcr.io/${{ github.repository }}/kmodbuild:arm64-${version} container/kmodbuild
podman push ghcr.io/${{ github.repository }}/kmodbuild:arm64-${version}
podman manifest create ghcr.io/${{ github.repository }}/kmodbuild:${version}
podman manifest add ghcr.io/${{ github.repository }}/kmodbuild:${version} ghcr.io/${{ github.repository }}/kmodbuild:amd64-${version}
podman manifest add ghcr.io/${{ github.repository }}/kmodbuild:${version} ghcr.io/${{ github.repository }}/kmodbuild:arm64-${version}
podman push ghcr.io/${{ github.repository }}/kmodbuild:${version}
publish_bare_flavors:
name: publish bare flavors
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
config: [ libc, python, nodejs, sapmachine ]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # [email protected]
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # pin@v3
with:
name: bare-${{ matrix.config }}-amd64
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # pin@v3
with:
name: bare-${{ matrix.config }}-arm64
- run: ls -lah
- name: publish bare container image
run: |
version=$(bin/garden-version "${{ inputs.version }}")
podman login -u token -p ${{ github.token }} ghcr.io
# Handling amd64 image
image="$(podman load < ${{ matrix.config }}-amd64.oci | awk '{ print $NF }')"
# Tagging and pushing amd64 with version
podman tag "$image" ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:amd64-$version
podman push ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:amd64-$version
# Tagging and pushing amd64 with nightly
podman tag "$image" ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:amd64-nightly
podman push ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:amd64-nightly
# Handling arm64 image
image="$(podman load < ${{ matrix.config }}-arm64.oci | awk '{ print $NF }')"
# Tagging and pushing arm64 with version
podman tag "$image" ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:arm64-$version
podman push ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:arm64-$version
# Tagging and pushing arm64 with nightly
podman tag "$image" ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:arm64-nightly
podman push ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:arm64-nightly
# Creating and pushing manifest for version tag
podman manifest create ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:$version
podman manifest add ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:$version ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:amd64-$version
podman manifest add ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:$version ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:arm64-$version
podman push ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:$version
# Creating and pushing manifest for nightly tag
podman manifest create ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:nightly
podman manifest add ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:nightly ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:amd64-nightly
podman manifest add ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:nightly ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:arm64-nightly
podman push ghcr.io/${{ github.repository }}/bare-${{ matrix.config }}:nightly