mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
* CI: update actions version - Update inlined code to use `$GITHUB_OUTPUT` see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ * Add dependabot config to update dependencies automatically
70 lines
2.1 KiB
YAML
70 lines
2.1 KiB
YAML
name: Publish Release
|
|
|
|
on:
|
|
release:
|
|
types: [released]
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.9
|
|
|
|
- name: Install dependencies
|
|
run: python -m pip install --upgrade poetry
|
|
|
|
# TODO: Set PYPI_API_TOKEN to api token from pip in secrets
|
|
- name: Configure pypi credentials
|
|
env:
|
|
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
run: poetry config http-basic.pypi __token__ "$PYPI_API_TOKEN"
|
|
|
|
- name: Publish release to pypi
|
|
run: |
|
|
poetry publish --build
|
|
poetry build
|
|
|
|
- name: Store artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
path: dist/*.tar.gz
|
|
name: manim.tar.gz
|
|
- name: Install Dependency
|
|
run: pip install requests
|
|
- name: Get Upload URL
|
|
id: create_release
|
|
shell: python
|
|
env:
|
|
access_token: ${{ secrets.GITHUB_TOKEN }}
|
|
tag_act: ${{ github.ref }}
|
|
run: |
|
|
import requests
|
|
import os
|
|
ref_tag = os.getenv('tag_act').split('/')[-1]
|
|
access_token = os.getenv('access_token')
|
|
headers = {
|
|
"Accept":"application/vnd.github.v3+json",
|
|
"Authorization": f"token {access_token}"
|
|
}
|
|
url = f"https://api.github.com/repos/ManimCommunity/manim/releases/tags/{ref_tag}"
|
|
c = requests.get(url,headers=headers)
|
|
upload_url=c.json()['upload_url']
|
|
with open(os.getenv('GITHUB_OUTPUT'), 'w') as f:
|
|
print(f"upload_url={upload_url}", file=f)
|
|
print(f"tag_name={ref_tag[1:]}", file=f)
|
|
|
|
- name: Upload Release Asset
|
|
id: upload-release
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: dist/manim-${{ steps.create_release.outputs.tag_name }}.tar.gz
|
|
asset_name: manim-${{ steps.create_release.outputs.tag_name }}.tar.gz
|
|
asset_content_type: application/gzip
|