mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Publish package via PyPI trusted publisher system
This commit is contained in:
parent
d3daa4d794
commit
410f60d6b3
1 changed files with 23 additions and 15 deletions
38
.github/workflows/main.yml
vendored
38
.github/workflows/main.yml
vendored
|
|
@ -32,7 +32,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Python ${{ matrix.config.python }}
|
- name: Set up Python ${{ matrix.config.python }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.config.python }}
|
python-version: ${{ matrix.config.python }}
|
||||||
|
|
@ -63,7 +63,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.9"
|
python-version: "3.9"
|
||||||
|
|
@ -81,7 +81,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.9"
|
python-version: "3.9"
|
||||||
|
|
@ -95,34 +95,42 @@ jobs:
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy
|
name: Deploy
|
||||||
|
environment: Deployment
|
||||||
needs: [test, lint, docs]
|
needs: [test, lint, docs]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.ref=='refs/heads/master' && github.event_name!='pull_request' }}
|
if: github.ref=='refs/heads/master' && github.event_name!='pull_request'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Python
|
with:
|
||||||
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.9"
|
python-version: "3.9"
|
||||||
|
|
||||||
- name: Check release
|
- name: Check release
|
||||||
id: check_release
|
id: check_release
|
||||||
run: |
|
run: |
|
||||||
python -m pip install pip --upgrade
|
python -m pip install --upgrade pip
|
||||||
pip install poetry
|
python -m pip install autopub[github]
|
||||||
pip install githubrelease
|
|
||||||
pip install --pre autopub
|
|
||||||
autopub check
|
autopub check
|
||||||
continue-on-error: true
|
|
||||||
- name: Publish
|
- name: Publish
|
||||||
if: steps.check_release.outcome=='success'
|
if: ${{ steps.check_release.outputs.autopub_release=='true' }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
||||||
run: |
|
run: |
|
||||||
git remote set-url origin https://$GITHUB_TOKEN@github.com/${{ github.repository }}
|
|
||||||
autopub prepare
|
autopub prepare
|
||||||
poetry build
|
|
||||||
autopub commit
|
autopub commit
|
||||||
|
autopub build
|
||||||
autopub githubrelease
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue