-
Notifications
You must be signed in to change notification settings - Fork 106
69 lines (57 loc) · 2.5 KB
/
attach-release-assets.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
name: Attach Release Assets
on:
workflow_dispatch:
release:
types: [created] # Note: Neither create nor publish trigger if a release is drafted first.
# In order of it to trigger the release needs to be published when created.
jobs:
upload-release-assets:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: master
# Setup Node
- uses: actions/setup-node@v3
with: { node-version: '16' }
- run: cd .github/actions && npm install @octokit/action
# Upload Artifacts as Release Assets
- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BB_VERSION=$(basename $GITHUB_REF)
BB_VERSION=${BB_VERSION:1}
echo "Release Version: $BB_VERSION"
artifacts=(
bladebit-v${BB_VERSION}-ubuntu-x86-64.tar.gz
bladebit-v${BB_VERSION}-centos-x86-64.tar.gz
bladebit-v${BB_VERSION}-ubuntu-arm64.tar.gz
bladebit-v${BB_VERSION}-centos-arm64.tar.gz
bladebit-v${BB_VERSION}-windows-x86-64.zip
bladebit-cuda-v${BB_VERSION}-ubuntu-x86-64.tar.gz
bladebit-cuda-v${BB_VERSION}-centos-x86-64.tar.gz
bladebit-cuda-v${BB_VERSION}-ubuntu-arm64.tar.gz
bladebit-cuda-v${BB_VERSION}-windows-x86-64.zip
green_reaper-v${BB_VERSION}-linux-x86-64.tar.gz
green_reaper-v${BB_VERSION}-linux-ARM64.tar.gz
green_reaper-v${BB_VERSION}-macos-x86-64.tar.gz
green_reaper-v${BB_VERSION}-macos-arm64.tar.gz
green_reaper-v${BB_VERSION}-windows-x86-64.zip
)
mkdir -p bin
for artifact_name in "${artifacts[@]}"; do
echo "Fetching $artifact_name"
url=$(node .github/actions/artifacts.mjs get-artifact-url $artifact_name)
# Download zipped artifact and unzip the contents
response_code=$(curl -w "%{http_code}" -o "bin/${artifact_name}.zip" "$url")
if [[ $response_code -ne 200 ]]; then
>&2 echo "Failed to download artifact"
exit 1
fi
unzip -d bin "bin/${artifact_name}.zip"
# Upload artifact to release
echo "Uploading release asset '${artifact_name}'"
node .github/actions/artifacts.mjs upload-release-asset $BB_VERSION $artifact_name bin/$artifact_name
done