Skip to content

Commit 7c1c925

Browse files
authored
Fix publish release workflow (#4600)
* ci: fix publish release workflow - Add sudo to apt-get calls (runner is non-root) - Add contents: write permission for uploading release assets - Drop uv sync before uv build (unnecessary) - Replace archived upload-release-asset action and redundant Python/requests API script with gh release upload; tag name is available directly from the release event context - Strip leading v from tag name to match built artifact filename * ci: set bash shell for release asset upload step
1 parent 000e779 commit 7c1c925

1 file changed

Lines changed: 5 additions & 31 deletions

File tree

.github/workflows/python-publish.yml

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
environment: release
1212
permissions:
1313
id-token: write
14+
contents: write
1415

1516
steps:
1617
- uses: actions/checkout@v6
@@ -28,7 +29,6 @@ jobs:
2829

2930
- name: Build and push release to PyPI
3031
run: |
31-
uv sync
3232
uv build
3333
uv publish
3434
@@ -37,37 +37,11 @@ jobs:
3737
with:
3838
path: dist/*.tar.gz
3939
name: manim.tar.gz
40-
- name: Install Dependency
41-
run: pip install requests
42-
- name: Get Upload URL
43-
id: create_release
44-
shell: python
45-
env:
46-
access_token: ${{ secrets.GITHUB_TOKEN }}
47-
tag_act: ${{ github.ref }}
48-
run: |
49-
import requests
50-
import os
51-
ref_tag = os.getenv('tag_act').split('/')[-1]
52-
access_token = os.getenv('access_token')
53-
headers = {
54-
"Accept":"application/vnd.github.v3+json",
55-
"Authorization": f"token {access_token}"
56-
}
57-
url = f"https://api.github.com/repos/ManimCommunity/manim/releases/tags/{ref_tag}"
58-
c = requests.get(url,headers=headers)
59-
upload_url=c.json()['upload_url']
60-
with open(os.getenv('GITHUB_OUTPUT'), 'w') as f:
61-
print(f"upload_url={upload_url}", file=f)
62-
print(f"tag_name={ref_tag[1:]}", file=f)
6340

6441
- name: Upload Release Asset
65-
id: upload-release
66-
uses: actions/upload-release-asset@v1
42+
shell: bash
6743
env:
6844
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69-
with:
70-
upload_url: ${{ steps.create_release.outputs.upload_url }}
71-
asset_path: dist/manim-${{ steps.create_release.outputs.tag_name }}.tar.gz
72-
asset_name: manim-${{ steps.create_release.outputs.tag_name }}.tar.gz
73-
asset_content_type: application/gzip
45+
run: |
46+
TAG=${{ github.event.release.tag_name }}
47+
gh release upload "$TAG" "dist/manim-${TAG#v}.tar.gz"

0 commit comments

Comments
 (0)