forked from ethereum/staking-deposit-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (171 loc) · 7.92 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
name: Build and Release
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
build_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r ./build_configs/linux/requirements.txt
- name: Build with build.spec
run: |
export PYTHONHASHSEED=42
export GITHUB_SHA_SHORT=${GITHUB_SHA::7}
export BUILD_FILE_NAME=staking_deposit-cli-${GITHUB_SHA_SHORT}-linux-amd64
mkdir ${BUILD_FILE_NAME}
pyinstaller --distpath ./dist/${BUILD_FILE_NAME} ./build_configs/linux/build.spec
- name: Compress the file
id: compress_file
run: |
export GITHUB_SHA_SHORT=${GITHUB_SHA::7}
export BUILD_FILE_NAME=staking_deposit-cli-${GITHUB_SHA_SHORT}-linux-amd64
tar -zcvf ${BUILD_FILE_NAME}.tar.gz ./dist/${BUILD_FILE_NAME}
mkdir -p ./build/linux
cp ${BUILD_FILE_NAME}.tar.gz ./build/linux
shasum_result=$(sha256sum ${BUILD_FILE_NAME}.tar.gz | head -c 64)
echo "shasum_result=${shasum_result}" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: build-linux
path: ./build/linux
outputs:
shasum_result: ${{ steps.compress_file.outputs.shasum_result }}
build_macos:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r ./build_configs/macos/requirements.txt
- name: Build with build.spec
run: |
export PYTHONHASHSEED=42
export GITHUB_SHA_SHORT=${GITHUB_SHA::7}
export BUILD_FILE_NAME=staking_deposit-cli-${GITHUB_SHA_SHORT}-macos
mkdir ${BUILD_FILE_NAME}
pyinstaller --distpath ./dist/${BUILD_FILE_NAME} ./build_configs/macos/build.spec
- name: Compress the file
id: compress_file
run: |
export GITHUB_SHA_SHORT=${GITHUB_SHA::7}
export BUILD_FILE_NAME=staking_deposit-cli-${GITHUB_SHA_SHORT}-macos
tar -zcvf ${BUILD_FILE_NAME}.tar.gz ./dist/${BUILD_FILE_NAME}
mkdir -p ./build/macos
cp ${BUILD_FILE_NAME}.tar.gz ./build/macos
shasum_result=$(shasum -a 256 ${BUILD_FILE_NAME}.tar.gz | head -c 64)
echo "shasum_result=${shasum_result}" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: build-macos
path: ./build/macos
outputs:
shasum_result: ${{ steps.compress_file.outputs.shasum_result }}
build_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r ./build_configs/windows/requirements.txt
- name: Build with build.spec
run: |
$PYTHONHASHSEED = 42
$GITHUB_SHA_SHORT = $env:GITHUB_SHA.Substring(0,7)
$BUILD_FILE_NAME = "staking_deposit-cli-" + $GITHUB_SHA_SHORT + "-windows-amd64"
mkdir $BUILD_FILE_NAME
$BUILD_FILE_NAME_PATH = ".\dist\" + $BUILD_FILE_NAME
pyinstaller --distpath $BUILD_FILE_NAME_PATH .\build_configs\windows\build.spec
- name: Compress the file
id: compress_file
run: |
$PYTHONHASHSEED = 42
$GITHUB_SHA_SHORT = $env:GITHUB_SHA.Substring(0,7)
$BUILD_FILE_NAME = "staking_deposit-cli-" + $GITHUB_SHA_SHORT + "-windows-amd64"
$BUILD_FILE_NAME_PATH = ".\dist\" + $BUILD_FILE_NAME
$ZIP_FILE_NAME = $BUILD_FILE_NAME + ".zip"
Compress-Archive -Path $BUILD_FILE_NAME_PATH -DestinationPath $ZIP_FILE_NAME
mkdir .\build\windows
copy $ZIP_FILE_NAME .\build\windows
$SHA_RESULT = Get-FileHash $ZIP_FILE_NAME -Algorithm SHA256 | Select-Object -ExpandProperty Hash
echo "shasum_result=${SHA_RESULT}" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: build-windows
path: ./build/windows
outputs:
shasum_result: ${{ steps.compress_file.outputs.shasum_result }}
release:
needs: [build_linux, build_macos, build_windows]
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
sha_short: ${{ steps.set_sha_short.outputs.sha_short }}
steps:
- uses: actions/checkout@v4
- name: Set sha_short
id: set_sha_short
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set tag_name
id: set_tag_name
run: echo "tag_name=$(git describe --tags)" >> $GITHUB_OUTPUT
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
body: |
### Release Artifacts
You can find the binary executable files under assets below.
| Platform | Compressed file | SHA256 Checksum |
| ------------- | ------------------------------------------------ | ---------------------------------------------------------------- |
| macOS amd64 | [staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-macos.tar.gz](https://github.com/overprotocol/staking-deposit-cli/releases/download/${{ steps.set_tag_name.outputs.tag_name }}/staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-macos.tar.gz) | ${{ needs.build_macos.outputs.shasum_result }} |
| Linux amd64 | [staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-linux-amd64.tar.gz](https://github.com/overprotocol/staking-deposit-cli/releases/download/${{ steps.set_tag_name.outputs.tag_name }}/staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-linux-amd64.tar.gz) | ${{ needs.build_linux.outputs.shasum_result }} |
| Windows amd64 | [staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-windows-amd64.zip](https://github.com/overprotocol/staking-deposit-cli/releases/download/${{ steps.set_tag_name.outputs.tag_name }}/staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-windows-amd64.zip) | ${{ needs.build_windows.outputs.shasum_result }} |
**Full Changelog**: https://github.com/overprotocol/staking-deposit-cli/commits/${{ steps.set_tag_name.outputs.tag_name }}
upload_assets:
needs: [release]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- platform: linux
file: staking_deposit-cli-${{ needs.release.outputs.sha_short }}-linux-amd64.tar.gz
- platform: macos
file: staking_deposit-cli-${{ needs.release.outputs.sha_short }}-macos.tar.gz
- platform: windows
file: staking_deposit-cli-${{ needs.release.outputs.sha_short }}-windows-amd64.zip
steps:
- name: Download build artifacts (${{ matrix.platform }})
uses: actions/download-artifact@v2
with:
name: build-${{ matrix.platform }}
path: ./build/${{ matrix.platform }}
- name: Upload Release Assets (${{ matrix.platform }})
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./build/${{ matrix.platform }}/${{ matrix.file }}
asset_name: ${{ matrix.file }}
asset_content_type: application/octet-stream