-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (123 loc) · 4.11 KB
/
release2.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
name: "Release Cross"
on:
workflow_dispatch:
inputs:
tag:
description: 'The release tag. Must follow Rust versioning conventions, e.g. "0.0.0"'
required: true
env:
CRATE_NAME: mamorurs-cli
GITHUB_TOKEN: ${{ github.token }}
RUST_BACKTRACE: 1
CARGO_NET_GIT_FETCH_WITH_CLI: true
permissions:
contents: write
jobs:
build:
name: Release - ${{ matrix.platform.release_for }}
strategy:
matrix:
platform:
- release_for: Linux-x86_64
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
bin: mamorurs-cli
name: mamorurs-cli-linux-x86_64.zip
# - release_for: Windows-x86_64
# os: windows-latest
# target: x86_64-pc-windows-msvc
# bin: mamorurs-cli.exe
# name: mamorurs-cli-Windows-x86_64.zip
- release_for: macOS-x86_64
os: macos-latest
target: x86_64-apple-darwin
bin: mamorurs-cli
name: mamorurs-cli-darwin-x86_64.tar.gz
- release_for: macOS-aarch64
os: macOS-latest
target: aarch64-apple-darwin
bin: mamorurs-cli
name: mamorurs-cli-darwin-aarch64.tar.gz
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: webfactory/[email protected]
with:
ssh-private-key: |
${{ secrets.MAMORU_CORE_KEY }}
${{ secrets.VALIDATION_CHAIN_KEY }}
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: "23.x"
- uses: Swatinem/rust-cache@v2
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: "build"
target: ${{ matrix.platform.target }}
args: "--locked --release"
strip: true
- name: Package release binaries
run: |
cd target/${{ matrix.platform.target }}/release/
if [[ "${{ matrix.platform.name }}" == *.zip ]]; then
zip ${{ matrix.platform.name }} ${{ matrix.platform.bin }}
else
tar -czvf ${{ matrix.platform.name }} ${{ matrix.platform.bin }}
fi
shell: bash
- name: Upload release binaries
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform.name }}
path: |
./target/${{ matrix.platform.target }}/release/${{ matrix.platform.name }}
release:
name: Release Binaries
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: ./release-binaries
# - name: Upload release binaries to GitHub Release
# uses: ncipollo/release-action@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# tag: ${{ github.event.inputs.tag }}
# name: Release ${{ github.event.inputs.tag }}
# artifacts: "./release-binaries/mamorurs-cli-*"
- name: release
uses: softprops/action-gh-release@v2
with:
files: ./release-binaries/*
draft: false
prerelease: false
tag_name: ${{ github.event.inputs.tag }}
body: "Release ${{ github.event.inputs.tag }}"
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: false
# - uses: AButler/[email protected]
# with:
# files: ./release-binaries/*.zip, ./release-binaries/*.tar.gz
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# release-tag: ${{ github.event.inputs.tag }}
# - name: Publish release artifacts
# uses: actions/upload-artifact@v4
# with:
# name: mamorurs-cli-${{ matrix.platform.release_for }}
# path: "mamorurs-cli-*"
#
# - name: Generate SHA-256
# run: shasum -a 256 ${{ matrix.platform.name }}
#
# - name: Publish GitHub release
# uses: softprops/action-gh-release@v2
# with:
# draft: true
# files: "mamorurs-cli-*"