-
Notifications
You must be signed in to change notification settings - Fork 2
74 lines (74 loc) · 2.31 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
name: release
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+*
env:
PACKAGE_NAME: kamu-api-server
BINARY_NAME: kamu-api-server
jobs:
build_linux:
name: Build / Linux
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1 # Uses rust-toolchain file
with:
components: rustfmt
target: ${{ matrix.target }}
override: true
- name: Install cross
run: cargo install cross --locked
- name: Build
run: cross build --release --target=${{ matrix.target }}
- uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}
if-no-files-found: error
create_release:
name: Create Release
runs-on: ubuntu-latest
needs: [build_linux]
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 }}
upload_assets_targz:
name: Upload Assets (tar.gz)
runs-on: ubuntu-latest
needs: [create_release]
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}
path: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}
- name: Compress Artifacts
run: tar -czvf ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.tar.gz ${{ 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 }}.tar.gz
asset_name: ${{ env.PACKAGE_NAME }}-${{ matrix.target }}.tar.gz
asset_content_type: application/gzip