fix: Update workflow.yml #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload Python Package | |
on: | |
push: | |
branches: | |
- master | |
permissions: | |
contents: write | |
id-token: write | |
actions: write | |
packages: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout master branch | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
fetch-depth: 0 | |
- name: Create and push to release branch | |
run: | | |
git checkout -b main | |
git push origin main | |
- name: Checkout release branch | |
run: git checkout main | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine python-semantic-release setuptools-scm | |
- name: Run semantic-release | |
env: | |
GH_TOKEN: ${{ secrets.FOSS_GITHUB_TOKEN }} | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
semantic-release version | |
semantic-release publish | |
- name: Build package | |
run: python -m build | |
- name: Publish package to PyPI | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: twine upload dist/* | |