diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94954db..4114062 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,25 +4,28 @@ on: types: [published] workflow_dispatch: - jobs: build: + name: Build and publish release to PyPI runs-on: ubuntu-latest + # This uses PyPI trusted publishing + environment: + name: pypi + url: https://pypi.org/p/wagtail-flags + permissions: + id-token: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: 3.11 + python-version: 3.12 - name: Install dependencies run: | python -m pip install --upgrade pip build - pip install twine wheel - name: Build the package run: | python -m build - - name: Upload to PyPI - run: twine upload dist/* - env: - TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 +