Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
YanhuiJessica committed Mar 29, 2024
1 parent ebe7cde commit 3e6ca47
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Publish distributions to PyPI
on: push

jobs:
build-n-publish:
name: Build and publish
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.x"
Expand All @@ -16,24 +16,45 @@ jobs:
- name: Replace Raw
run: python3 -c "lines = open('README.rst', 'r').readlines(); header = open('PYPIHEADER.rst', 'r').readlines(); open('README.rst', 'w').writelines(header + ['\n'] + lines[14:])"
- name: Build
run: python3 -m build --outdir dist/
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/cheb3
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
update-docs-requirements:
name: Update docs requirements
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install pip-tools
run: python3 -m pip install pip-tools
- name: Update requirements.txt
if: startsWith(github.ref, 'refs/tags')
run: cd docs/ && pip-compile requirements.in > requirements.txt
- uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down

0 comments on commit 3e6ca47

Please sign in to comment.