-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload package in CI via PyPI trusted publisher
- Loading branch information
1 parent
84ddb97
commit 5f63b53
Showing
1 changed file
with
17 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,10 +46,10 @@ jobs: | |
with: | ||
retry: true | ||
|
||
- name: Install poetry | ||
- name: Install Poetry | ||
run: pipx install poetry | ||
|
||
- name: Setup Python | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
|
@@ -64,38 +64,45 @@ jobs: | |
- name: Run linters | ||
run: poetry run invoke lint --diff | ||
|
||
|
||
deploy: | ||
name: Deploy | ||
environment: Deployment | ||
needs: [test, lint] | ||
runs-on: ubuntu-latest | ||
if: github.ref=='refs/heads/main' && github.event_name!='pull_request' | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
|
||
- name: Setup Python | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Check release | ||
id: check_release | ||
continue-on-error: true | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install poetry githubrelease httpx==0.16.1 autopub | ||
python -m pip install autopub[github] | ||
autopub check | ||
- name: Publish | ||
if: steps.check_release.outcome=='success' | ||
if: ${{ steps.check_release.outputs.autopub_release=='true' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
git remote set-url origin https://[email protected]/${{ github.repository }} | ||
autopub prepare | ||
poetry build | ||
autopub commit | ||
autopub build | ||
autopub githubrelease | ||
poetry publish -u __token__ -p $PYPI_PASSWORD | ||
- name: Upload package to PyPI | ||
if: ${{ steps.check_release.outputs.autopub_release=='true' }} | ||
uses: pypa/gh-action-pypi-publish@release/v1 |