This repository has been archived by the owner on Jul 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (120 loc) · 4.23 KB
/
main.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
name: Build && Release
on:
push:
permissions: write-all
concurrency:
group: ${{ github.workflow }}-${{ startsWith(github.event.head_commit.message, 'ver') && github.event.head_commit.message || 'dev' }}
cancel-in-progress: true
jobs:
Build:
name: Build - ${{ matrix.release_for }}
strategy:
matrix:
include:
# linux
- release_for: Linux-ARM
os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
bin: songbird_node
name: aarch64-unknown-linux-gnu.zip
command: both
- release_for: Linux-i686
os: ubuntu-20.04
target: i686-unknown-linux-gnu
bin: songbird_node
name: i686-unknown-linux-gnu.zip
command: both
- release_for: Linux-x86_64
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
bin: songbird_node
name: x86_64-unknown-linux-gnu.zip
command: both
# win
- release_for: Windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
bin: songbird_node.exe
name: x86_64-pc-windows-msvc.zip
command: both
- release_for: Windows-i686
os: windows-latest
target: i686-pc-windows-msvc
bin: songbird_node.exe
name: i686-pc-windows-msvc.zip
command: both
# mac
- release_for: macOS-x86_64
os: macOS-latest
target: x86_64-apple-darwin
bin: songbird_node
name: x86_64-apple-darwin.zip
command: both
- release_for: macOS-ARM
os: macOS-latest
target: aarch64-apple-darwin
bin: songbird_node
name: aarch64-apple-darwin.zip
command: both
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Shout Commit ID
id: vars
shell: bash
run: echo "sha_short=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Install Rust
# Or @nightly if you want
uses: dtolnay/rust-toolchain@stable
# Arguments to pass in
with:
# Make Rust compile to our target (defined in the matrix)
targets: ${{ matrix.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --target ${{ matrix.target }}
- name: Build archive
shell: bash
run: |
# Replace with the name of your binary
binary_name="songbird_node"
mkdir zip_cp
mkdir artifact
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv "target/${{ matrix.target }}/release/$binary_name.exe" zip_cp
else
mv "target/${{ matrix.target }}/release/$binary_name" zip_cp
fi
mv "config.json" zip_cp
7z a "artifact/${{ matrix.release_for }}.zip" "./zip_cp/*"
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Build
path: artifact/*
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Delete Old Release
if: ${{ startsWith(steps.previoustag.outputs.tag, 'dev-') }}
continue-on-error: true
uses: dev-drprasad/delete-tag-and-release@v1.0
with:
tag_name: ${{ steps.previoustag.outputs.tag }}
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: true
- name: Upload to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifact/*
asset_name: ${{ matrix.asset_name }}
tag: ${{ startsWith(github.event.head_commit.message, 'ver') && github.event.head_commit.message || steps.vars.outputs.sha_short }}
file_glob: true
prerelease: ${{ !startsWith(github.event.head_commit.message, 'ver') }}