Bump version #23
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: release | |
on: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+* | |
env: | |
IMAGE_BASE_NAME: ghcr.io/kamu-data/engine-datafusion | |
# See: https://github.com/docker/metadata-action#tags-input | |
IMAGE_TAGS: | | |
type=raw,value=latest | |
type=semver,pattern={{major}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{version}} | |
IMAGE_LABELS: | | |
org.opencontainers.image.vendor=Kamu Data Inc. | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runs-on: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
platform: linux/amd64 | |
qemu: false | |
- runs-on: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
platform: linux/arm64 | |
qemu: true | |
name: Build | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- uses: actions/checkout@v4 | |
# Collects metadata about build for image tags and labels | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.IMAGE_BASE_NAME }} | |
tags: ${{ env.IMAGE_TAGS }} | |
labels: ${{ env.IMAGE_LABELS }} | |
- name: Set up QEMU | |
if: matrix.qemu | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
target: ${{ matrix.target }} | |
override: true | |
- name: Install cross | |
run: cargo install cross --locked | |
- name: Build binary | |
run: make build TARGET_ARCH=${{ matrix.target }} | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Images with multiple architectures need to be pushed as one manifest. Pushing tagged images separately | |
# simply overrides the tag instead of merging the architectures. Since we are doing a matrix | |
# build where architectures are built on different runners in parallel we have to push | |
# individual images by digest and then assemble them together into one manifest that will be tagged. | |
# | |
# Source: https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners | |
- name: Build and push by digest | |
id: build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: image/Dockerfile | |
platforms: ${{ matrix.platform }} | |
build-args: target_arch=${{ matrix.target }} | |
labels: ${{ steps.meta.outputs.labels }} | |
outputs: type=image,name=${{ env.IMAGE_BASE_NAME }},push-by-digest=true,name-canonical=true,push=true | |
- name: Export digest | |
run: | | |
mkdir -p /tmp/digests | |
digest="${{ steps.build.outputs.digest }}" | |
touch "/tmp/digests/${digest#sha256:}" | |
- name: Upload digest | |
uses: actions/upload-artifact@v4 | |
with: | |
name: digests-${{ matrix.target }} | |
path: /tmp/digests/* | |
if-no-files-found: error | |
retention-days: 1 | |
merge: | |
name: Create multi-platform image | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- name: Download digests | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/digests | |
pattern: digests-* | |
merge-multiple: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.IMAGE_BASE_NAME }} | |
tags: ${{ env.IMAGE_TAGS }} | |
labels: ${{ env.IMAGE_LABELS }} | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create manifest list and push | |
working-directory: /tmp/digests | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
$(printf '${{ env.IMAGE_BASE_NAME }}@sha256:%s ' *) | |
- name: Inspect final image | |
run: | | |
docker buildx imagetools inspect ${{ env.IMAGE_BASE_NAME }}:${{ steps.meta.outputs.version }} | |
create_release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
needs: [merge] | |
steps: | |
- uses: actions/checkout@v4 | |
# Sets the header for the release description | |
- run: echo "" > RELEASE_HEAD.md | |
# Extracts relevant section from CHANGELOG.md and outputs it into RELEASE.md | |
- uses: CSchoel/release-notes-from-changelog@v1 | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
body_path: RELEASE.md |