Skip to content

Commit

Permalink
Update publish_package.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
james03160927 authored May 2, 2024
1 parent 0d419e0 commit 9a2326f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/publish_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
build-n-publish:
name: Build and publish Python distributions to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v3

Expand All @@ -16,16 +18,16 @@ jobs:
with:
python-version: '3.10'

- name: Install build dependencies
run: python -m pip install --upgrade pip build
- name: Install build and tomlkit dependencies
run: python -m pip install --upgrade pip build tomlkit

- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Update version in pyproject.toml
run: |
python -c "import toml; pyproj = toml.load('pyproject.toml'); pyproj['project']['version'] = '${{ env.VERSION }}'; toml.dump(pyproj, open('pyproject.toml', 'w'))"
python -c "import tomlkit; with open('pyproject.toml', 'r') as file: pyproj = tomlkit.load(file); pyproj['project']['version'] = '${{ env.VERSION }}'; with open('pyproject.toml', 'w') as file: tomlkit.dump(pyproj, file)"
- name: Build distribution
run: python -m build --sdist --wheel --outdir dist/
Expand Down

0 comments on commit 9a2326f

Please sign in to comment.