Fixing multiplatform release #17
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]+* | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runs-on: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- runs-on: macos-14 | |
target: aarch64-apple-darwin | |
name: Build | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- name: Setup variables | |
run: | | |
TAG=${{ github.event.release.tag_name }} | |
VERSION=${TAG#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "IMAGE=ghcr.io/kamu-data/engine-datafusion:$VERSION" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
target: ${{ matrix.target }} | |
override: true | |
- name: Install docker (macOS) | |
if: contains(matrix.runs-on, 'macos-') | |
# See: https://blog.netnerds.net/2022/11/docker-macos-github-actions/ | |
run: | | |
brew install docker | |
colima start | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install musl (linux) | |
if: contains(matrix.target, '-musl') | |
# See: https://blog.urth.org/2023/03/05/cross-compiling-rust-projects-in-github-actions/ | |
run: | | |
sudo apt-get update --yes | |
sudo apt-get install --yes musl-tools | |
- name: Build engine | |
run: | | |
cargo build --release --target ${{ matrix.target }} | |
- name: Build image | |
run: | | |
docker build \ | |
--build-arg target_arch=${{ matrix.target }} \ | |
--build-arg version=${{ env.VERSION }} \ | |
-t ${{ env.IMAGE }} \ | |
-f image/Dockerfile \ | |
. | |
- name: Publish image | |
run: | | |
docker push ${{ env.IMAGE }} | |
create_release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Create Release | |
id: 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 | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} |