-
Notifications
You must be signed in to change notification settings - Fork 713
143 lines (137 loc) · 4.48 KB
/
cd.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
name: CD
on:
push:
tags:
- TEST.*
- DEVN.*
- MAIN.*
- SECU.*
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
platform: [x86_64, arm64]
include:
- os: ubuntu-latest
platform: x86_64
target: x86_64-unknown-linux-gnu
name: release_linux.tar.gz
- os: ubuntu-latest
platform: arm64
target: aarch64-unknown-linux-gnu
name: release_linux_arm64.tar.gz
- os: windows-latest
platform: x86_64
target: x86_64-pc-windows-gnu
name: release_windows.zip
- os: macOS-latest
platform: x86_64
target: x86_64-apple-darwin
name: release_macos.tar.gz
- os: macOS-latest
platform: arm64
target: aarch64-apple-darwin
name: release_macos_aarch64.tar.gz
exclude:
- os: windows-latest
platform: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- uses: ilammy/setup-nasm@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.74.1
target: ${{ matrix.target }}
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
if: matrix.platform != 'arm64'
with:
command: build
args: --profile release_prebuilt
- uses: actions-rs/cargo@v1
if: matrix.platform == 'arm64'
with:
use-cross: true
command: build
args: --profile release_prebuilt --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
mkdir massa && cd massa && mkdir massa-node && mkdir massa-client
if [[ "${{ matrix.platform }}" == "arm64" ]]
then
cp -v ../target/${{ matrix.target }}/release_prebuilt/massa-node massa-node/massa-node
cp -v ../target/${{ matrix.target }}/release_prebuilt/massa-client massa-client/massa-client
else
cp -v ../target/release_prebuilt/massa-node massa-node/massa-node
cp -v ../target/release_prebuilt/massa-client massa-client/massa-client
fi
cp -rv ../massa-node/config massa-node/config
cp -rv ../massa-node/base_config massa-node/base_config
cp -rv ../massa-node/storage massa-node/storage
cp -rv ../massa-client/config massa-client/config
cp -rv ../massa-client/base_config massa-client/base_config
cd ..
if [[ "${{ matrix.os }}" == "windows-latest" ]]
then
7z a massa_${GITHUB_REF/refs\/tags\//}_${{ matrix.name }} massa
else
tar czvf massa_${GITHUB_REF/refs\/tags\//}_${{ matrix.name }} massa
fi
cd -
- name: Upload ${{ matrix.os }}_${{ matrix.platform }} artifacts
uses: actions/upload-artifact@v4
with:
name: massa_artifacts_${{ matrix.name }}
path: |
massa_*.zip
massa_*.tar.gz
if-no-files-found: error
- name: Publish ${{ matrix.os }}_${{ matrix.platform }} artifacts
uses: softprops/action-gh-release@v1
with:
files: |
massa_*.zip
massa_*.tar.gz
checksum:
needs: release
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move all artifacts to workspace
run: |
source_directory="artifacts"
release_directory="${{ github.workspace }}"
zip_pattern="massa_*.zip"
tar_pattern="massa_*.tar.gz"
mkdir -p "$release_directory"
find "$source_directory" -type f \( -name "$zip_pattern" -o -name "$tar_pattern" \) -exec mv -t "$release_directory" {} +
- name: Generate checksums file
uses: jmgilman/actions-generate-checksum@v1
with:
method: sha256
patterns: |
massa_*.zip
massa_*.tar.gz
output: checksums.txt
- name: Publish checksums file
uses: softprops/action-gh-release@v1
with:
files: |
checksums.txt