-
Notifications
You must be signed in to change notification settings - Fork 14
192 lines (177 loc) · 6.12 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: release
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+*
env:
PACKAGE_NAME: kamu-cli
BINARY_NAME: kamu
KAMU_WEB_UI_VERSION: "0.19.0"
jobs:
build:
strategy:
fail-fast: true
matrix:
include:
# Keep in sync with artifact upload matrix below
#
# TODO: Add minimal targets that are stripped and do not embed WebUI
- name: Linux / amd64 / glibc
runs-on: ubuntu-latest
target: x86_64-unknown-linux-gnu
use-cross: true
features: ingest-ftp,web-ui
- name: Linux / amd64 / musl
runs-on: ubuntu-latest
target: x86_64-unknown-linux-musl
use-cross: true
features: ingest-ftp,web-ui
- name: Linux / arm64 / glibc
runs-on: ubuntu-latest
target: aarch64-unknown-linux-gnu
use-cross: true
features: ingest-ftp,web-ui
- name: Linux / arm64 / musl
runs-on: ubuntu-latest
target: aarch64-unknown-linux-musl
use-cross: true
features: ingest-ftp,web-ui
- name: MacOS / amd64
runs-on: macos-13
target: x86_64-apple-darwin
use-cross: false
features: ingest-ftp,web-ui
- name: MacOS / arm64
runs-on: macos-14
target: aarch64-apple-darwin
use-cross: false
features: ingest-ftp,web-ui
- name: Windows / amd64
runs-on: windows-latest
target: x86_64-pc-windows-msvc
use-cross: false
features: ingest-ftp
binary-ext: '.exe'
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.runs-on }}
env:
# This will be replaced with `cross` for cross-compilation targets
CARGO: cargo
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1 # Uses rust-toolchain file
with:
target: ${{ matrix.target }}
override: true
- uses: cargo-bins/cargo-binstall@main
- name: Install cross
if: matrix.use-cross
shell: bash
run: |
cargo binstall cross -y
echo "CARGO=cross" >> $GITHUB_ENV
- name: Fetch web UI artifacts
if: contains(matrix.features, 'web-ui')
shell: bash
run: |
wget https://github.com/kamu-data/kamu-web-ui/releases/download/v${{ env.KAMU_WEB_UI_VERSION }}/kamu-web-ui-any.tar.gz
tar -xf kamu-web-ui-any.tar.gz
echo "KAMU_WEB_UI_DIR=../../../kamu-web-ui-any" >> $GITHUB_ENV
- name: Build
shell: bash
run: |
${{ env.CARGO }} build \
-p kamu-cli \
--release \
--target=${{ matrix.target }} \
--features=${{ matrix.features }}
- name: Rename binary
shell: bash
run: |
mv \
target/${{ matrix.target }}/release/${{ env.PACKAGE_NAME }}${{ matrix.binary-ext }} \
target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}${{ matrix.binary-ext }}
- uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}${{ matrix.binary-ext }}
if-no-files-found: error
create_release:
name: Create Release
runs-on: ubuntu-latest
needs: [ build ]
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
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
body_path: RELEASE.md
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload_assets:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
format: tar.gz
media-type: application/gzip
- target: x86_64-unknown-linux-musl
format: tar.gz
media-type: application/gzip
- target: aarch64-unknown-linux-gnu
format: tar.gz
media-type: application/gzip
- target: aarch64-unknown-linux-musl
format: tar.gz
media-type: application/gzip
- target: x86_64-apple-darwin
format: tar.gz
media-type: application/gzip
- target: aarch64-apple-darwin
format: tar.gz
media-type: application/gzip
- target: x86_64-pc-windows-msvc
format: zip
media-type: application/zip
name: Upload Assets (${{ matrix.target }})
runs-on: ubuntu-latest
needs: [ create_release ]
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}
path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}
- name: Archive (tar.gz)
if: matrix.format == 'tar.gz'
run: |
tar -czvf \
${{ env.PACKAGE_NAME }}-${{ matrix.target }}.tar.gz \
${{ env.PACKAGE_NAME }}-${{ matrix.target }}
- name: Archive (zip)
if: matrix.format == 'zip'
run: |
zip -r \
${{ env.PACKAGE_NAME }}-${{ matrix.target }}.zip \
${{ env.PACKAGE_NAME }}-${{ matrix.target }}
- name: Upload Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.${{ matrix.format }}
asset_name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.${{ matrix.format }}
asset_content_type: ${{ matrix.media-type }}