forked from stratum-mining/stratum
-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (167 loc) · 7.44 KB
/
release-bin.yaml
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# as well as releasing binaries of the roles
# (translator, pool, mining_proxy) to github.
# If the binary releases do fail to due to not having tags, force run the `autoversion` workflow
# on the main branch and merge the resulting PR to create the tags and move them to the main branch.
name: Release Binaries
on:
# Manually run by going to "Actions/Release" in Github and running the workflow
workflow_dispatch:
jobs:
github_release_translator:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: translator_sv2
asset_name: translator_sv2-linux-amd64
# - os: windows-latest
# artifact_name: translator_sv2.exe
# asset_name: translator_sv2-windows-amd64
- os: macos-latest
artifact_name: translator_sv2
asset_name: translator_sv2-macos-amd64
steps:
- uses: actions/checkout@v3
# The tags are not in scope until we fetch them from main
# This will fail if there are no tags available
- name: fetch tags
run: git fetch origin --tags
# Find the latest translator tag by listing folders in `.git/refs/tags` with pattern `translator_sv2`,
# taking the last one, and setting to `TRANSLATOR_TAG` env variable. This will be used as the "tag" in the
# Build step
- name: set env unix
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo "TRANSLATOR_TAG=$(echo refs/tags/$(ls .git/refs/tags | grep 'translator_sv2' | tail -n 1))" >> $GITHUB_ENV
# This does not work
- name: set env windows
if: matrix.os == 'windows-latest'
run: echo "$(dir .git/refs/tags | findstr "translator_sv2")"
# This will fail on a Windows build. Must use if statement to check if running on Windows and use `dir` instead)
# `dir` will fail on mac builds
- name: check refs
run: ls .git/refs/tags
# Debugging step to ensure tag is correct
- name: check env
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo ${{ env.TRANSLATOR_TAG }}
# Debugging step to ensure tag is correct
- name: check env
if: matrix.os == 'windows-latest'
run: echo "${{ env.TRANSLATOR_TAG }}"
# Action to release build by given tag
- name: Build
run: cargo build --release --locked --package translator_sv2
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ env.TRANSLATOR_TAG }}
github_release_pool:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# This defines what environments we will build on
include:
- os: ubuntu-latest
artifact_name: pool_sv2
asset_name: pool_sv2-linux-amd64
# - os: windows-latest
# artifact_name: pool_sv2.exe
# asset_name: pool_sv2-windows-amd64
- os: macos-latest
artifact_name: pool_sv2
asset_name: pool_sv2-macos-amd64
steps:
- uses: actions/checkout@v3
# The tags are not in scope until we fetch them from main
# This will fail if there are no tags available
- name: fetch tags
run: git fetch origin --tags
# Find the latest pool tag by listing folders in `.git/refs/tags` with pattern `pool_sv2`,
# taking the last one, and setting to `POOL_TAG` env variable. This will be used as the "tag" in the
# Build step
- name: set env unix
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo "POOL_TAG=$(echo refs/tags/$(ls .git/refs/tags | grep 'pool_sv2' | tail -n 1))" >> $GITHUB_ENV
# This does not work
- name: set env windows
if: matrix.os == 'windows-latest'
run: echo "$(dir .git/refs/tags | findstr "pool_sv2")"
# This will fail on a Windows build. Must use if statement to check if running on Windows and use `dir` instead)
# `dir` will fail on mac builds
- name: check refs
run: ls .git/refs/tags
# Debugging step to ensure tag is correct
- name: check env
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo ${{ env.POOL_TAG }}
# Debugging step to ensure tag is correct
- name: check env
if: matrix.os == 'windows-latest'
run: echo "${{ env.POOL_TAG }}"
# Action to release build by given tag
- name: Build
run: cargo build --release --locked --package pool_sv2
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ env.POOL_TAG }}
github_release_mining_proxy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# This defines what environments we will build on
include:
- os: ubuntu-latest
artifact_name: mining_proxy_sv2
asset_name: mining_proxy_sv2-linux-amd64
# - os: windows-latest
# artifact_name: mining_proxy_sv2.exe
# asset_name: mining_proxy_sv2-windows-amd64
- os: macos-latest
artifact_name: mining_proxy_sv2
asset_name: mining_proxy_sv2-macos-amd64
steps:
- uses: actions/checkout@v3
# The tags are not in scope until we fetch them from main
# This will fail if there are no tags available
- name: fetch tags
run: git fetch origin --tags
# Find the latest mining proxy tag by listing folders in `.git/refs/tags` with pattern `mining_proxy_sv2`,
# taking the last one, and setting to `MINING_PROXY_TAG` env variable. This will be used as the "tag" in the
# Build step
- name: set env unix
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo "MINING_PROXY_TAG=$(echo refs/tags/$(ls .git/refs/tags | grep 'mining_proxy_sv2' | tail -n 1))" >> $GITHUB_ENV
# This does not work
- name: set env windows
if: matrix.os == 'windows-latest'
run: echo "$(dir .git/refs/tags | findstr "mining_proxy_sv2")"
# This will fail on a Windows build. Must use if statement to check if running on Windows and use `dir` instead)
# `dir` will fail on mac builds
- name: check refs
run: ls .git/refs/tags
# Debugging step to ensure tag is correct
- name: check env
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo ${{ env.MINING_PROXY_TAG }}
# Debugging step to ensure tag is correct
- name: check env
if: matrix.os == 'windows-latest'
run: echo "${{ env.MINING_PROXY_TAG }}"
# Action to release build by given tag
- name: Build
run: cargo build --release --locked --package mining_proxy_sv2
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ env.MINING_PROXY_TAG }}