Skip to content

Commit

Permalink
Update deployment flow to latest standard
Browse files Browse the repository at this point in the history
* Install AutoPub release from PyPI — not pre-release from test PyPI
* Install `githubrelease` from repo until new package is released
* Use PyPI Trusted Publisher system to upload package instead of Poetry
  • Loading branch information
justinmayer committed Feb 2, 2024
1 parent c3c90a6 commit 2fb9904
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set Poetry cache
Expand All @@ -43,32 +43,37 @@ jobs:
environment: Deployment
needs: [test]
runs-on: ubuntu-latest
if: ${{ github.ref=='refs/heads/main' && github.event_name!='pull_request' }}
if: github.ref=='refs/heads/main' && github.event_name!='pull_request'

permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.10"

- name: Check release
id: check_release
run: |
python -m pip install poetry
python -m pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ autopub[github]
echo "##[set-output name=release;]$(autopub check)"
python -m pip install autopub
python -m pip install https://github.com/autopub/github-release/archive/pyproject.zip
autopub check
- name: Publish
if: ${{ steps.check_release.outputs.release=='' }}
if: ${{ steps.check_release.outputs.autopub_release=='true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
autopub prepare
autopub commit
poetry build
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

0 comments on commit 2fb9904

Please sign in to comment.