-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (83 loc) · 2.86 KB
/
release.yml
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
name: Release
on:
push:
tags:
- '*'
jobs:
github-release-draft:
name: 'Create GitHub Release Draft'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.VERSION }}
upload-url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: v${{ steps.get_version.outputs.VERSION }}
draft: true
linux-binary:
name: 'Upload Binary for Linux'
runs-on: ubuntu-latest
needs: github-release-draft
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install dependent packages
run: sudo apt install -y musl-tools
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-unknown-linux-musl
override: true
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=x86_64-unknown-linux-musl
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.github-release-draft.outputs.upload-url }}
asset_path: target/x86_64-unknown-linux-musl/release/efmt
asset_name: efmt-${{ needs.github-release-draft.outputs.version }}.x86_64-unknown-linux-musl
asset_content_type: application/octet-stream
macos-binary:
name: 'Upload Binary for MacOS'
runs-on: macos-11 # TODO: Use `macos-latest` once it supports `aarch64-apple-darwin`
needs: github-release-draft
strategy:
matrix:
target: ["x86_64-apple-darwin", "aarch64-apple-darwin"]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=${{ matrix.target }}
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.github-release-draft.outputs.upload-url }}
asset_path: target/${{ matrix.target }}/release/efmt
asset_name: efmt-${{ needs.github-release-draft.outputs.version }}.${{ matrix.target }}
asset_content_type: application/octet-stream