@@ -13,23 +13,20 @@ jobs:
1313 name : Build Binary (amd64)
1414 uses : ./.github/workflows/build-k3s.yaml
1515 with :
16- cache : ' ' # No cache for release builds
1716 upload-build : true
1817
1918 build-arm64 :
2019 name : Build Binary (arm64)
2120 uses : ./.github/workflows/build-k3s.yaml
2221 with :
2322 arch : arm64
24- cache : ' ' # No cache for release builds
2523 upload-build : true
2624
2725 build-arm :
2826 name : Build Binary (arm)
2927 uses : ./.github/workflows/build-k3s.yaml
3028 with :
3129 arch : arm
32- cache : ' ' # No cache for release builds
3330 upload-build : true
3431
3532 push-release-image :
5249 username : ${{ github.repository_owner }}
5350 password : ${{ secrets.GITHUB_TOKEN }}
5451
55- - name : COnfigure image tags
52+ - name : Configure image tags
5653 id : tag_config
5754 run : |
5855 TAG=${GITHUB_REF#refs/tags/}
7471 id : meta
7572 uses : docker/metadata-action@v5
7673 with :
77- images : ghcr.io/${{ github.repository_owner }}/k3s
74+ images : |
75+ ghcr.io/${{ github.repository_owner }}/k3s
7876 flavor : latest=false
7977 tags : ${{ steps.tag_config.outputs.tag_spec }}
8078
@@ -102,3 +100,96 @@ jobs:
102100 build-args : |
103101 DRONE_TAG=${{ github.ref_name }}
104102
103+ upload-release-airgap :
104+ name : Build Airgap Pkg (${{ matrix.arch }})
105+ runs-on : ubuntu-latest # Runs on standard runner, docker pulls with --platform
106+ permissions :
107+ contents : write # Needed to update release with assets
108+ strategy :
109+ matrix :
110+ arch : [amd64, arm64, arm]
111+
112+ steps :
113+ - name : Checkout code
114+ uses : actions/checkout@v4
115+
116+ - name : Set up Docker Buildx
117+ uses : docker/setup-buildx-action@v3
118+
119+ - name : Install Dependencies
120+ run : sudo apt-get update -y && sudo apt-get install -y zstd pigz
121+
122+ - name : Create Airgap Package (${{ matrix.arch }})
123+ run : |
124+ mkdir -p ./dist/artifacts
125+ ./scripts/package-airgap ${{ matrix.arch }}
126+
127+ - name : Caculate Airgap sha256sum
128+ run : sha256sum dist/artifacts/k3s-airgap-images-${{ matrix.arch }}* | sed 's|dist/artifacts/||' > dist/artifacts/k3s-airgap-images-${{ matrix.arch }}.sha256sum
129+
130+ - name : Upload Airgap sha256sum
131+ uses : actions/upload-artifact@v4
132+ with :
133+ name : k3s-airgap-images-${{ matrix.arch }}.sha256sum
134+ path : dist/artifacts/k3s-airgap-images-${{ matrix.arch }}.sha256sum
135+
136+ - name : Upload k3s-images.txt to Release
137+ uses : softprops/action-gh-release@v2
138+ # This action is recommended by GITHUB, they don't support a first party action for releases
139+ # See https://github.com/actions/create-release?tab=readme-ov-file#github-action---releases-api
140+ if : ${{ matrix.arch == 'amd64' }}
141+ with :
142+ files : |
143+ dist/artifacts/k3s-images.txt
144+ env :
145+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
146+
147+ - name : Upload Airgap Assets to Release
148+ uses : softprops/action-gh-release@v2
149+ with :
150+ files : |
151+ dist/artifacts/k3s-airgap-images*
152+ env :
153+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
154+
155+ upload-release-assets :
156+ name : Prepare and Upload Release Assets
157+ permissions :
158+ contents : write # Needed to update release with assets
159+ runs-on : ubuntu-latest
160+ needs : [build-amd64, build-arm64, build-arm, upload-release-airgap]
161+ steps :
162+ - name : Checkout code
163+ uses : actions/checkout@v4
164+
165+ - name : " Download Binaries and Airgap sha256sum"
166+ uses : actions/download-artifact@v4
167+ with :
168+ pattern : k3s*
169+ path : ./dist/artifacts
170+ merge-multiple : true
171+
172+ - name : " Combine and format sha256sum files"
173+ run : |
174+ for arch in amd64 arm64 arm; do
175+ output_file="./dist/artifacts/sha256sum-${arch}.txt"
176+ cat ./dist/artifacts/k3s-airgap-images-$arch*.sha256sum >> "$output_file"
177+ rm ./dist/artifacts/k3s-airgap-images-$arch*.sha256sum
178+ if [[ "$arch" == "amd64" ]]; then
179+ cat ./dist/artifacts/k3s.sha256sum >> "$output_file"
180+ rm ./dist/artifacts/k3s.sha256sum # Remove the original file to avoid uploading it
181+ else
182+ cat ./dist/artifacts/k3s-${arch}.sha256sum >> "$output_file"
183+ rm ./dist/artifacts/k3s-${arch}.sha256sum # Remove the original file to avoid uploading it
184+ fi
185+ done
186+
187+ - name : Upload Assets to Release
188+ uses : softprops/action-gh-release@v2.2.1
189+ with :
190+ files : |
191+ dist/artifacts/k3s*
192+ dist/artifacts/sha256sum*
193+ env :
194+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
195+
0 commit comments