-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (78 loc) · 2.4 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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 }}