-
Notifications
You must be signed in to change notification settings - Fork 6
148 lines (121 loc) · 4.07 KB
/
release-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
name: Release Atleta Node binaries
env:
CARGO_TERM_COLOR: always
on:
workflow_dispatch:
push:
branches:
- devnet
- testnet
- stagenet
- mainnet
tags:
- 'release-v*'
permissions:
contents: write
jobs:
define_vars:
runs-on: ubuntu-latest
outputs:
release_name: ${{ steps.vars.outputs.release_name }}
commit_sha: ${{ steps.vars.outputs.commit_sha }}
steps:
- id: vars
run: |
commit_sha=${{ github.sha }}
echo "commit_sha=${commit_sha:0:7}" >> "$GITHUB_OUTPUT"
echo "release_name=$(echo ${{ github.ref_name }} | sed 's/^release-//')" >> "$GITHUB_OUTPUT"
linux_build:
runs-on: ubuntu-latest
needs: define_vars
outputs:
artifact: ${{ steps.artifact.outputs.name }}
steps:
- run: |
sudo apt-get update
sudo apt-get install protobuf-compiler
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
components: rust-src
- uses: actions/checkout@v4
- id: build
env:
RUSTFLAGS: --allow warnings
run: cargo build --locked --release
- id: artifact
env:
commit_sha: ${{ needs.define_vars.outputs.commit_sha }}
run: |
echo "name=build-${{ env.commit_sha }}-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact.outputs.name }}
path: ./target/release/atleta-node
if-no-files-found: error
macos_build:
runs-on: macos-latest
needs: define_vars
outputs:
artifact: ${{ steps.artifact.outputs.name }}
steps:
- run: |
brew update
brew upgrade rustup
brew install protobuf
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
components: rust-src
- uses: actions/checkout@v4
- id: build
env:
RUSTFLAGS: --allow warnings
run: cargo build --locked --release
- id: artifact
env:
commit_sha: ${{ needs.define_vars.outputs.commit_sha }}
run: |
echo "name=build-${{ env.commit_sha }}-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact.outputs.name }}
path: ./target/release/atleta-node
if-no-files-found: error
publish_release:
runs-on: ubuntu-latest
needs: [define_vars, linux_build, macos_build]
steps:
- uses: actions/download-artifact@v4
env:
artifact: ${{ needs.linux_build.outputs.artifact }}
with:
name: ${{ env.artifact }}
path: release/linux
- uses: actions/download-artifact@v4
env:
artifact: ${{ needs.macos_build.outputs.artifact }}
with:
name: ${{ env.artifact }}
path: release/macos
- id: bundle
env:
tarball: ${{ format('{0}-release.tar.gz', needs.define_vars.outputs.release_name) }}
run: |
tar czvf ${{ env.tarball }} --directory=release .
echo "archive=${{ env.tarball }}" > "$GITHUB_OUTPUT"
# deleting tag w/ release is required (otherwise we have inconsistent release content)
- if: ${{ github.ref == 'refs/heads/devnet' }}
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
run: |
gh --repo ${{ github.repository }} release delete release-devnet --yes --cleanup-tag
- id: publish
env:
GH_TOKEN: ${{ github.token }}
release_name: ${{ needs.define_vars.outputs.release_name }}
release_tag: ${{ startsWith(github.ref, 'refs/tags') && github.ref_name || format('release-{0}', github.ref_name) }}
release_archive: ${{ steps.bundle.outputs.archive }}
run: |
gh --repo ${{ github.repository }} release create ${{ env.release_tag }} --latest --title ${{ env.release_name }} ${{ env.release_archive }}