Skip to content

ci: Use trusted publishing to publish to PyPI #51

ci: Use trusted publishing to publish to PyPI

ci: Use trusted publishing to publish to PyPI #51

Workflow file for this run

name: Main
on: [push]
env:
IMAGE_NAME: nydok-${{ github.run_id }}
permissions:
contents: read
pages: write
id-token: write
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Lint
run: make lint
- name: Run tests
run: make test
docs:
name: Deploy documentation
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create docs
run: |
make docs &&
mv .local/output/docs public
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v1
with:
path: public
- name: Deploy to Pages
id: deployment
uses: actions/deploy-pages@v2
build:
name: Build package
needs: [test]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate changelog
run: make changelog
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: changelog.md
- name: Build package dist
run: make build-package
- name: Store package artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 1
pypi-publish:
needs: [build]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/nydok
permissions:
id-token: write
steps:
- name: Download dist artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1