-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (100 loc) · 3.3 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
121
name: Release
on:
push:
branches:
- main
tags:
- 'v*.*.*'
jobs:
build:
strategy:
matrix:
target:
- os: windows-latest
target: x86_64-pc-windows-msvc
name: windows-x86_64
- os: windows-latest
target: aarch64-pc-windows-msvc
name: windows-arm64
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
name: linux-x86_64-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
name: linux-arm64-musl
- os: macos-latest
target: x86_64-apple-darwin
name: darwin-x86_64
- os: macos-latest
target: aarch64-apple-darwin
name: darwin-arm64
name: Build ${{ matrix.target.name }}
runs-on: ${{ matrix.target.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target.target }}
- name: Build
run: |
rustup target add ${{ matrix.target.target }}
cargo build --release --target ${{ matrix.target.target }}
- name: compress
if: matrix.target.os != 'windows-latest'
run: |
mv target/${{ matrix.target.target }}/release/chiritori .
tar -czf chiritori-${{ matrix.target.name }}.tar.gz ./chiritori
- name: compress
if: matrix.target.os == 'windows-latest'
run: |
mv target/${{ matrix.target.target }}/release/chiritori.exe .
7z a chiritori-${{ matrix.target.name }}.zip ./chiritori.exe
- name: Upload Release Asset
if: matrix.target.os != 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: chiritori-${{ matrix.target.name }}
if-no-files-found: error
path: |
chiritori-${{ matrix.target.name }}.tar.gz
- name: Upload Release Asset
if: matrix.target.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: chiritori-${{ matrix.target.name }}
if-no-files-found: error
path: |
chiritori-${{ matrix.target.name }}.zip
release:
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create Release (nightly)
uses: softprops/action-gh-release@v1
with:
tag_name: nightly
draft: true
prerelease: true
files: chiritori-*
- name: Create Release (Release)
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-alpha') && !contains(github.ref, '-beta')
with:
tag_name: ${{ github.ref }}
files: chiritori-*
- name: Create Release (Prerelease)
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v') && (contains(github.ref, '-alpha') || contains(github.ref, '-beta'))
with:
tag_name: ${{ github.ref }}
files: chiritori-*
prerelease: true