Skip to content

Commit 4846c51

Browse files
authored
Update release_compilation.yml
1 parent a11ea1c commit 4846c51

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

.github/workflows/release_compilation.yml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
name: Build and Release
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
7-
branches:
8-
- main
4+
release:
5+
types: [published]
96

107
env:
118
BUILD_TYPE: Release
@@ -72,20 +69,36 @@ jobs:
7269
runs-on: ubuntu-latest
7370

7471
steps:
72+
- name: Install jq
73+
run: sudo apt-get install -y jq
74+
7575
- name: Download Linux artifacts
7676
uses: actions/download-artifact@v3
7777
with:
7878
name: HeronTriangle-Linux
79-
path: ./linux
79+
path: ./artifacts/linux
80+
8081
- name: Download Windows artifacts
8182
uses: actions/download-artifact@v3
8283
with:
8384
name: HeronTriangle-Windows
84-
path: ./windows
85-
86-
- name: Create GitHub Release
87-
uses: softprops/action-gh-release@v1
88-
with:
89-
files: |
90-
linux/HeronTriangle-Linux.zip
91-
windows/HeronTriangle-Windows.zip
85+
path: ./artifacts/windows
86+
87+
- name: Attach Artifacts to Release
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
run: |
91+
release_id=$(curl -s \
92+
-H "Authorization: Bearer $GITHUB_TOKEN" \
93+
https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.id')
94+
echo "Release ID: $release_id"
95+
96+
for file in ./artifacts/linux/* ./artifacts/windows/*; do
97+
filename=$(basename "$file")
98+
echo "Uploading $filename to release $release_id"
99+
curl -X POST \
100+
-H "Authorization: Bearer $GITHUB_TOKEN" \
101+
-H "Content-Type: application/zip" \
102+
--data-binary @"$file" \
103+
"https://uploads.github.com/repos/${{ github.repository }}/releases/$release_id/assets?name=$filename"
104+
done

0 commit comments

Comments
 (0)