-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (130 loc) · 5.85 KB
/
binaries.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
142
143
144
145
146
147
148
149
150
151
name: Rust
on:
push:
tags:
- '*'
jobs:
CD:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch:
- { target: aarch64-unknown-linux-gnu , use-cross: true}
- { target: i686-unknown-linux-gnu , use-cross: true }
- { target: x86_64-pc-windows-gnu , use-cross: true}
- { target: aarch64-linux-android, use-cross: true}
- { target: x86_64-unknown-linux-gnu }
- { target: x86_64-unknown-linux-musl, use-cross: true}
steps:
- uses: actions/checkout@v2
- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> "$GITHUB_ENV"
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> "$GITHUB_ENV"
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.arch.use-cross }}
command: build
args: --release --features auto_updates --target=${{ matrix.arch.target }}
- name: mkdir
shell: bash
run: |
mkdir ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.arch.target }}
- name: Copy
shell: bash
if: ${{ matrix.arch.target != 'x86_64-pc-windows-gnu' }}
run: |
cp target/${{ matrix.arch.target }}/release/${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.arch.target }}/${{ matrix.arch.name }}
tar -zcvf ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.arch.target }}.tar.gz ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.arch.target }}/${{ matrix.arch.name }}
- name: Copy
shell: bash
if: ${{ matrix.arch.target == 'x86_64-pc-windows-gnu' }}
run: |
sudo add-apt-repository universe
sudo apt install p7zip-full p7zip-rar
cp target/${{ matrix.arch.target }}/release/${{ env.PROJECT_NAME }}.exe ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.arch.target }}/${{ matrix.arch.name }}.exe
cd ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.arch.target }}
7z a ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.arch.target }}.zip *
- name: Upload package artifact
uses: actions/upload-artifact@master
if: ${{ matrix.arch.target == 'x86_64-pc-windows-gnu' }}
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.arch.target }}/${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.arch.target }}.zip
- name: Upload package artifact
uses: actions/upload-artifact@master
if: ${{ matrix.arch.target != 'x86_64-pc-windows-gnu' }}
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.arch.target }}.tar.gz
windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
target: ['x86_64-pc-windows-msvc']
steps:
- uses: actions/checkout@v2
- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> "$GITHUB_ENV"
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> "$GITHUB_ENV"
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --features auto_updates --target ${{ matrix.target }}
- name: Copy
shell: bash
run: |
mkdir ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.target }}
cp target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }}.exe ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.target }}/${{ env.PROJECT_NAME }}.exe
cd ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.target }}
"/c/Program Files/7-Zip/7z.exe" a ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.target }}.zip *
- name: Upload package artifact
uses: actions/upload-artifact@master
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.target }}/${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.target }}.zip
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> "$GITHUB_ENV"
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> "$GITHUB_ENV"
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --features auto_updates
- name: Copy
shell: bash
run: |
mkdir ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-x86_64-apple-darwin
cp target/release/${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-x86_64-apple-darwin/${{ env.PROJECT_NAME }}
tar -czvf ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-x86_64-apple-darwin.tar.gz ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-x86_64-apple-darwin
- name: Upload package artifact
uses: actions/upload-artifact@master
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-x86_64-apple-darwin.tar.gz
release:
needs: [CD, macos, windows]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- name: Release
uses: softprops/action-gh-release@v1
with:
body: |
view the CHANGELOG.md for full changes
files: |
dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}