provider-kairos/.github/workflows/release-arm.yaml
Dimitris Karakasilis c633dbd7fa
Use re-usable linting workflow (#376)
as part of https://github.com/kairos-io/kairos/issues/1234

---------

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
2023-05-19 18:28:41 +03:00

131 lines
4.2 KiB
YAML

name: 'Build arm images'
on:
push:
tags:
- '*'
jobs:
get-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- id: set-matrix
run: |
content=`cat ./releases-arm.json`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=matrix::{\"include\": $content }"
docker:
runs-on: ubuntu-latest
needs:
- get-matrix
permissions:
id-token: write # OIDC support
contents: write
strategy:
fail-fast: false
matrix: ${{fromJson(needs.get-matrix.outputs.matrix)}}
steps:
- name: Release space from worker
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Install Cosign
uses: sigstore/cosign-installer@main
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build 🔧
env:
FLAVOR: ${{ matrix.flavor }}
MODEL: ${{ matrix.model }}
run: |
./earthly.sh +all-arm --MODEL=$MODEL --FLAVOR=$FLAVOR --K3S_VERSION=${{ matrix.k3s_version }}
- name: Push 🔧
if: startsWith(github.ref, 'refs/tags/')
run: |
docker push $(cat build/IMAGE)
- name: Sign image
if: startsWith(github.ref, 'refs/tags/')
env:
COSIGN_YES: true
run: |
export IMAGE=$(cat build/IMAGE)
docker push "$IMAGE" # Otherwise .RepoDigests will be empty for some reason
cosign sign $(docker image inspect --format='{{index .RepoDigests 0}}' "$IMAGE")
- name: Upload Image
if: startsWith(github.ref, 'refs/tags/')
run: |
curl https://luet.io/install.sh | sudo sh
IMAGE=$(cat build/IMAGE | sed 's/:/-img:/')
sudo tar cvf build.tar build
sudo luet util pack $IMAGE build.tar image.tar
sudo -E docker load -i image.tar
sudo -E docker push "$IMAGE"
sudo rm -rf build/IMAGE build/VERSION
image_and_iso_arm64_generic:
needs:
- get-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flavor:
- "opensuse-leap-arm-generic"
steps:
- uses: actions/checkout@v3
- name: Install earthly
uses: Luet-lab/luet-install-action@v1
with:
repository: quay.io/kairos/packages
packages: utils/earthly
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Login to Quay Registry
run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Build 🔧
run: |
K3S_LATEST=$(curl -s https://update.k3s.io/v1-release/channels | \
jq -rc '[ .data[] | select(.type == "channel") | select(.name | test("testing") | not) | .latest ] | unique | .[-1]')
earthly -P +all-arm-generic --FLAVOR=${{ matrix.flavor }} --K3S_VERSION=$K3S_LATEST
sudo mv build release
- name: Push to quay
run: |
IMAGE=$(cat release/IMAGE)
docker push "$IMAGE"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
release/*