Fixing the gh action 3: #42
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: PyPi release | ||
on: [push, workflow_dispatch] | ||
jobs: | ||
build: | ||
name: PyPi release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install environment requirements | ||
run: >- | ||
python -m | ||
pip install | ||
-r | ||
requirements.txt | ||
- name: Run UTs | ||
run: >- | ||
python -m | ||
unittest | ||
discover | ||
-v | ||
- name: Install pypa/build | ||
run: >- | ||
python -m | ||
pip install | ||
build | ||
--user | ||
- name: Bump patch version | ||
run: >- | ||
python -c "from onepassword.utils import bump_version; bump_version(version_type='patch')" | ||
- name: Build a source tarball | ||
run: >- | ||
python -m | ||
build | ||
--sdist | ||
--outdir dist/ | ||
. | ||
pypi-publish: | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
steps: | ||
- name: Publish distribution 📦 to Test PyPI | ||
# Specifying a GitHub environment is optional, but strongly encouraged | ||
if: ${{ github.ref != 'refs/heads/main' }} | ||
environment: test | ||
Check failure on line 51 in .github/workflows/publish-to-pypi.yml GitHub Actions / PyPi releaseInvalid workflow file
|
||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
- name: Publish distribution 📦 to PyPI | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
environment: release | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
- name: Add, commit and push version update | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
run: | | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
git checkout main | ||
git add . | ||
git commit -m "[actions skip] GitHub bumping the version" | ||
git push |