-
-
Notifications
You must be signed in to change notification settings - Fork 3
120 lines (100 loc) · 3.07 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
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
name: Release
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
crates-io:
name: Publish to crates.io
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- run: cargo package --allow-dirty
- run: cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
macos:
name: Build for macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: x86_64-apple-darwin
- name: Build x86_64
run: cargo build --release --target x86_64-apple-darwin --all-features
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: aarch64-apple-darwin
- name: Build aarch64 (Apple Silicon)
run: cargo build --release --target aarch64-apple-darwin --all-features
- run: ls -l target
- name: Create universal binary
run: lipo -create -output merlon target/x86_64-apple-darwin/release/merlon target/aarch64-apple-darwin/release/merlon
- uses: actions/upload-artifact@v3
with:
name: merlon-macos
path: merlon
linux:
name: Build for Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [x86_64]
steps:
- uses: actions/checkout@v3
- name: Build x86_64
run: cargo build --release --target ${{ matrix.target }}-unknown-linux-gnu
- uses: actions/upload-artifact@v3
with:
name: merlon-linux-${{ matrix.target }}
path: target/${{ matrix.target }}-unknown-linux-gnu/release/merlon
github_release:
name: Create GitHub release
runs-on: ubuntu-latest
needs: [linux, macos]
steps:
- uses: actions/checkout@v3
- name: Download artifacts from previous jobs
uses: actions/download-artifact@v3
- name: Rename artifacts
run: |
mkdir -p release
mv merlon-linux-x86_64/merlon release/merlon-linux-x86_64
mv merlon-macos/merlon release/merlon-macos
- name: Get version from tag
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Create release
uses: "marvinpinto/action-automatic-releases@latest"
if: "startsWith(github.ref, 'refs/tags/v')"
with:
repo_token: "${{ secrets.RELEASE_GITHUB_TOKEN }}"
prerelease: false
title: "${{ steps.get_version.outputs.VERSION }}"
files: |
release/*
LICENSE
- name: Create prerelease
uses: "marvinpinto/action-automatic-releases@latest"
if: "!startsWith(github.ref, 'refs/tags/')"
with:
repo_token: "${{ secrets.RELEASE_GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
release/*
LICENSE