-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (126 loc) · 3.78 KB
/
build.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Release
on:
push:
branches:
- main
- rc
- beta
- alpha
permissions:
contents: write
jobs:
get-version:
uses: shiipou/github-actions/.github/workflows/get-version.yml@main
with:
prerelease-branches: "^(rc|beta|alpha)$"
build:
needs: get-version
if: ${{ needs.get-version.outputs.will-release == 'true' }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
env:
VERSION: ${{ needs.get-version.outputs.version }}
strategy:
matrix: # Need to find what's the best target for `x86-x64-linux` and remove the others (gnu or musl)
include:
- target: aarch64-unknown-linux-musl
os: linux
arch: aarch64
runner: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: linux
arch: x86_64
runner: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows
arch: x86_64
runner: windows-latest
file_extension: '.exe'
- target: aarch64-pc-windows-msvc
os: windows
arch: aarch64
runner: windows-latest
file_extension: '.exe'
- target: x86_64-apple-darwin
os: macos
arch: x86_64
runner: macos-latest
- target: aarch64-apple-darwin
os: macos
arch: aarch64
runner: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Install cargo-edit
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-edit
- name: Set version
uses: actions-rs/cargo@v1
with:
command: set-version
args: ${{ env.VERSION }}
- name: Build target
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release -F cli --target ${{ matrix.target }}
- name: Rename artifact to platform specific name
run: |
mv target/${{ matrix.target }}/release/clone${{ matrix.file_extension }} ./clone-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: clone-${{ matrix.os }}-${{ matrix.arch }}
path: ./clone-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }}
release:
needs: [ get-version, build ]
if: ${{ needs.get-version.outputs.will-release == 'true' }}
uses: shiipou/github-actions/.github/workflows/release.yml@main
with:
version: ${{ needs.get-version.outputs.version }}
changelogs: ${{ needs.get-version.outputs.changelogs }}
is-prerelease: ${{ needs.get-version.outputs.is-prerelease == 'true' }}
download-artifacts: true
assets: artifacts/**/*
publish:
needs: [ get-version, build ]
if: ${{ needs.get-version.outputs.will-release == 'true' }}
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.get-version.outputs.version }}
jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Install cargo-edit
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-edit
- name: Set version
uses: actions-rs/cargo@v1
with:
command: set-version
args: ${{ env.VERSION }}
- name: Build target
uses: actions-rs/cargo@v1
with:
command: publish
args: -p clone-project-manager --allow-dirty --token "${{ secrets.CARGO_TOKEN }}"