-
Notifications
You must be signed in to change notification settings - Fork 212
218 lines (210 loc) · 9.36 KB
/
release.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
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
name: Build and Release
run-name: Release ${{ github.ref_name }}
on:
push:
tags:
- '*'
jobs:
build-and-upload:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
outname_sufix: "linux-amd64"
- os: ubuntu-latest-arm-8-cores
outname_sufix: "linux-arm64"
- os: macos-13
outname_sufix: "mac-amd64"
- os: [self-hosted, macOS, ARM64, go-spacemesh]
outname_sufix: "mac-arm64"
- os: windows-2022
outname_sufix: "win-amd64"
permissions:
contents: 'read'
id-token: 'write'
steps:
- shell: bash
run: echo "OUTNAME=go-spacemesh-${{ github.ref_name }}-${{ matrix.outname_sufix }}" >> $GITHUB_ENV
- name: Add OpenCL support - Ubuntu
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-latest-arm-8-cores' }}
run: sudo apt-get update -q && sudo apt-get install -qy ocl-icd-opencl-dev libpocl2
- name: Install dependencies in windows
if: ${{ matrix.os == 'windows-2022' }}
run: choco install make wget zip
- name: disable Windows Defender - Windows
if: ${{ matrix.os == 'windows-2022' }}
run: |
Set-MpPreference -DisableRealtimeMonitoring $true
- name: Set new git config - Windows
if: ${{ matrix.os == 'windows-2022' }}
run: |
git config --global pack.window 1
git config --global core.compression 0
git config --global http.postBuffer 1024M
- name: Check out Git repository
uses: actions/checkout@v4
with:
lfs: true
ssh-key: ${{ secrets.GH_ACTION_PRIVATE_KEY }}
- uses: extractions/netrc@v2
with:
machine: github.com
username: ${{ secrets.GH_ACTION_TOKEN_USER }}
password: ${{ secrets.GH_ACTION_TOKEN }}
if: vars.GOPRIVATE
- name: Setup Go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: "go.mod"
cache: ${{ runner.arch != 'arm64' }}
- name: Build go-spacemesh
shell: bash
run: |
make install
make build VERSION=${{ github.ref_name }}
- name: Build merge-nodes
shell: bash
run: |
make merge-nodes VERSION=${{ github.ref_name }}
- name: Create release archive
shell: bash
env:
OUTNAME: ${{ env.OUTNAME }}
run: |
mkdir $OUTNAME
mv ./build/* $OUTNAME
rm -f $OUTNAME/post.h
zip -r $OUTNAME.zip $OUTNAME
- name: Setup gcloud authentication
uses: google-github-actions/auth@v2
with:
project_id: ${{ secrets.GCP_WI_PROJECT_ID }}
workload_identity_provider: ${{ secrets.GCP_WI_PROVIDER_SA }}
service_account: ${{ secrets.GCP_WI_SA }}
token_format: access_token
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: "469.0.0"
- name: Upload zip to GCP
uses: google-github-actions/upload-cloud-storage@v2
with:
path: ${{ env.OUTNAME }}.zip
destination: ${{ secrets.GCP_BUCKET }}/${{ github.ref_name }}/
- name: Copy build
shell: bash
run: |
mkdir build-zip
cp ${{ env.OUTNAME }}.zip build-zip
- name: Upload zip to R2
run: >
aws s3 sync build-zip
s3://${{ secrets.CLOUDFLARE_GO_SM_BUILDS_BUCKET }}/${{ github.ref_name }}
--endpoint-url https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
--acl public-read --follow-symlinks
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_GO_SM_BUILDS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_GO_SM_BUILDS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
- name: Install coreutils
if: ${{ matrix.os == 'macos-13' || matrix.os == '[self-hosted, macOS, ARM64, go-spacemesh]' }}
run: brew install coreutils
- name: Calculate the hashsum of the zip file
if: ${{ matrix.os != 'windows-2022' }}
shell: bash
run: |
sha256sum ${{ env.OUTNAME }}.zip | awk '{ print $1 }' > sha256-${{ matrix.outname_sufix }}.txt
- name: Calculate the hashsum of the zip file (Windows)
if: ${{ matrix.os == 'windows-2022' }}
run: |
(Get-FileHash ${{ env.OUTNAME }}.zip -Algorithm SHA256).Hash > sha256-${{ matrix.outname_sufix }}.txt
- uses: actions/upload-artifact@v4
with:
name: sha256-${{ matrix.outname_sufix }}
path: sha256-${{ matrix.outname_sufix }}.txt
if-no-files-found: error
retention-days: 5
release:
runs-on: ubuntu-22.04
needs: build-and-upload
permissions:
contents: 'write'
id-token: 'write'
steps:
- name: Download the artifacts
uses: actions/download-artifact@v4
- name: Generate the env variables
shell: bash
run: |
echo "OUTNAME_WIN_AMD64=go-spacemesh-${{ github.ref_name }}-win-amd64" >> $GITHUB_ENV
echo "OUTNAME_LINUX_AMD64=go-spacemesh-${{ github.ref_name }}-linux-amd64" >> $GITHUB_ENV
echo "OUTNAME_LINUX_ARM64=go-spacemesh-${{ github.ref_name }}-linux-arm64" >> $GITHUB_ENV
echo "OUTNAME_MAC_AMD64=go-spacemesh-${{ github.ref_name }}-mac-amd64" >> $GITHUB_ENV
echo "OUTNAME_MAC_ARM64=go-spacemesh-${{ github.ref_name }}-mac-arm64" >> $GITHUB_ENV
echo "SHA256_WIN_AMD64=$(cat sha256-win-amd64/sha256-win-amd64.txt)" >> $GITHUB_ENV
echo "SHA256_LINUX_AMD64=$(cat sha256-linux-amd64/sha256-linux-amd64.txt)" >> $GITHUB_ENV
echo "SHA256_LINUX_ARM64=$(cat sha256-linux-arm64/sha256-linux-arm64.txt)" >> $GITHUB_ENV
echo "SHA256_MAC_AMD64=$(cat sha256-mac-amd64/sha256-mac-amd64.txt)" >> $GITHUB_ENV
echo "SHA256_MAC_ARM64=$(cat sha256-mac-arm64/sha256-mac-arm64.txt)" >> $GITHUB_ENV
echo "win-amd64: $(cat sha256-win-amd64/sha256-win-amd64.txt)" >> sha256sum.yaml
echo "linux-amd64: $(cat sha256-linux-amd64/sha256-linux-amd64.txt)" >> sha256sum.yaml
echo "linux-arm64: $(cat sha256-linux-arm64/sha256-linux-arm64.txt)" >> sha256sum.yaml
echo "mac-amd64: $(cat sha256-mac-amd64/sha256-mac-amd64.txt)" >> sha256sum.yaml
echo "mac-arm64: $(cat sha256-mac-arm64/sha256-mac-arm64.txt)" >> sha256sum.yaml
- name: Setup gcloud authentication
uses: google-github-actions/auth@v2
with:
project_id: ${{ secrets.GCP_WI_PROJECT_ID }}
workload_identity_provider: ${{ secrets.GCP_WI_PROVIDER_SA }}
service_account: ${{ secrets.GCP_WI_SA }}
token_format: access_token
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: "469.0.0"
- name: Upload sha256sums to GCP
uses: google-github-actions/upload-cloud-storage@v2
with:
path: sha256sum.yaml
destination: ${{ secrets.GCP_BUCKET }}/${{ github.ref_name }}/
- name: Copy sha256sum
shell: bash
run: |
mkdir sha256sum
cp sha256sum.yaml sha256sum
- name: Upload sha256sums to R2
run: >
aws s3 sync sha256sum
s3://${{ secrets.CLOUDFLARE_GO_SM_BUILDS_BUCKET }}/${{ github.ref_name }}
--endpoint-url https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
--acl public-read --follow-symlinks
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_GO_SM_BUILDS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_GO_SM_BUILDS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
- name: Create Release
uses: softprops/action-gh-release@v2
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
body: |
## Zip Files
- Windows amd64: https://go-spacemesh-release-builds.spacemesh.network/${{ github.ref_name }}/${{ env.OUTNAME_WIN_AMD64 }}.zip
- macOS amd64: https://go-spacemesh-release-builds.spacemesh.network/${{ github.ref_name }}/${{ env.OUTNAME_MAC_AMD64 }}.zip
- macOS arm64: https://go-spacemesh-release-builds.spacemesh.network/${{ github.ref_name }}/${{ env.OUTNAME_MAC_ARM64 }}.zip
- Linux amd64: https://go-spacemesh-release-builds.spacemesh.network/${{ github.ref_name }}/${{ env.OUTNAME_LINUX_AMD64 }}.zip
- Linux arm64: https://go-spacemesh-release-builds.spacemesh.network/${{ github.ref_name }}/${{ env.OUTNAME_LINUX_ARM64 }}.zip
## checksum - Zip files
YAML with all the checksums of this version : https://go-spacemesh-release-builds.spacemesh.network/${{ github.ref_name }}/sha256sum.yaml
- Windows amd64 - sha256 : ${{ env.SHA256_WIN_AMD64 }}
- Linux amd64 - sha256: ${{ env.SHA256_LINUX_AMD64 }}
- Linux arm64 - sha256: ${{ env.SHA256_LINUX_ARM64 }}
- macOS amd64 - sha256: ${{ env.SHA256_MAC_AMD64 }}
- macOS arm64 - sha256: ${{ env.SHA256_MAC_ARM64 }}
For information about changes in this release see the [changelog](https://github.com/spacemeshos/go-spacemesh/blob/${{ github.ref_name }}/CHANGELOG.md).
draft: false
prerelease: true