v6.0.0 #129
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build Images" | |
on: | |
push: | |
release: | |
types: | |
- published | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
if: "github.event.head_commit.message != 'chore: storing version and changelog'" | |
strategy: | |
matrix: | |
flavour: | |
- name: aws | |
platforms: "linux/amd64,linux/arm64" | |
- name: azure | |
platforms: "linux/amd64,linux/arm64" | |
- name: gcloud | |
platforms: "linux/amd64,linux/arm64" | |
- name: simple | |
platforms: "linux/amd64,linux/arm64" | |
- name: tanzu | |
platforms: "linux/amd64" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install cosign | |
uses: sigstore/[email protected] | |
# Set up QEMU to be able to build to multiple architectures | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Setup Docker buildx | |
uses: docker/[email protected] | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.flavour.name }} | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=edge,branch=develop | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
- name: Prepare build | |
id: prepare | |
run: | | |
export BUILD_DATE=$(date -Iseconds) | |
export FLAVOUR=${{ matrix.flavour.name }} | |
cat build/Dockerfile.prefix > Dockerfile | |
cat "flavour/${{ matrix.flavour.name }}/Dockerfile.flavour" >> Dockerfile | |
# Download mo | |
curl -sSL https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o mo | |
chmod +x mo | |
cat build/Dockerfile.suffix.mo | ./mo > build/Dockerfile.suffix | |
cat build/Dockerfile.suffix >> Dockerfile | |
{ | |
echo 'labels<<EOF' | |
cat build/labels.txt.mo | ./mo | sed -re "s/^/ /gm" # Add whitespace to insert it as annotations | |
echo EOF | |
} >> "$GITHUB_OUTPUT" | |
rm mo | |
env: | |
FLAVOUR: "${{ matrix.flavour.name }}" | |
- name: Clean up Docker | |
run: | | |
docker system prune -f --filter "until=5h" | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
pull: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: | | |
${{ steps.prepare.outputs.labels }} | |
no-cache: true | |
platforms: ${{ matrix.flavour.platforms }} | |
- name: Sign the published Docker image | |
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --yes {}@${{ steps.build-and-push.outputs.digest }} |