Skip to content

Commit 53e24b8

Browse files
committed
ci: attach build artifacts to release
1 parent 541a6b5 commit 53e24b8

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- main
66
- dev
77
release:
8-
types: [released]
8+
types: [published]
99

1010
env:
1111
DEFAULT_PYTHON: "3.12"
@@ -62,11 +62,40 @@ jobs:
6262
deps: ${{ github.workspace }}/dist/*.whl
6363
suffix: "-${{ matrix.octoprint }}"
6464

65+
publish-on-release:
66+
name: 📦 Publish build & source on GitHub release
67+
if: github.event_name == 'release'
68+
needs:
69+
- pre-commit
70+
- e2e
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: ⬇ Download build result
74+
uses: actions/download-artifact@v6
75+
with:
76+
name: dist
77+
path: dist
78+
79+
- name: ⬆ Upload to release
80+
run: |
81+
UPLOAD_URL="https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets"
82+
83+
for file in dist/*; do
84+
[ -e "$file" ] || exit 1
85+
echo "Uploading $file..."
86+
response=$(curl -s -XPOST \
87+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
88+
-H "Content-Type: $(file -b --mime-type $file)" \
89+
--data-binary @$file \
90+
"$UPLOAD_URL?name=$(basename $file)")
91+
echo "$response" | jq -e '.errors' >/dev/null && echo "Error uploading $file to release: $response" && exit 1 || true
92+
done
93+
6594
publish-on-testpypi:
6695
name: 📦 Publish on TestPyPI
6796
if: github.event_name == 'release'
6897
needs:
69-
- e2e
98+
- publish-on-release
7099
runs-on: ubuntu-latest
71100
environment:
72101
name: testpypi

0 commit comments

Comments
 (0)