mirror of
https://github.com/kairos-io/provider-kairos.git
synced 2025-10-19 22:42:26 +00:00
68 lines
2.3 KiB
YAML
68 lines
2.3 KiB
YAML
name: Build image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.repository }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
get-matrix:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- run: |
|
|
git fetch --prune --unshallow
|
|
sudo apt update && sudo apt install -y jq
|
|
- id: set-matrix
|
|
run: |
|
|
content=`curl https://raw.githubusercontent.com/kairos-io/kairos/master/.github/flavors.json | jq 'map(select(.frameworkonly != "true"))'`
|
|
# 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 }"
|
|
build:
|
|
needs:
|
|
- get-matrix
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write # OIDC support
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{fromJson(needs.get-matrix.outputs.matrix)}}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- run: |
|
|
git fetch --prune --unshallow
|
|
- name: setup-docker
|
|
uses: docker-practice/actions-setup-docker@master
|
|
- 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
|
|
- name: Install Cosign
|
|
uses: sigstore/cosign-installer@main
|
|
- name: Login to Quay Registry
|
|
run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io
|
|
- name: Build main 🔧
|
|
env:
|
|
FLAVOR: ${{ matrix.flavor }}
|
|
IMAGE: quay.io/kairos/kairos-${{ matrix.flavor }}:latest
|
|
run: |
|
|
./earthly.sh +all --IMAGE=$IMAGE --FLAVOR=$FLAVOR
|
|
- name: Push to quay
|
|
env:
|
|
COSIGN_YES: true
|
|
IMAGE: "quay.io/kairos/kairos-${{ matrix.flavor }}"
|
|
TAG: "latest"
|
|
run: |
|
|
docker push "$IMAGE:$TAG"
|
|
cosign sign $(docker image inspect --format='{{index .RepoDigests 0}}' "$IMAGE:$TAG")
|