Skip to content

Commit

Permalink
ci: use trusted publisher deployment (#26)
Browse files Browse the repository at this point in the history
Moving to trusted pub.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Oct 3, 2023
1 parent efb36a6 commit 78b4b42
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 24 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CD

on:
workflow_dispatch:
release:
types:
- published

jobs:
dist:
name: Distribution build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v1

publish:
name: Publish
needs: [dist]
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: Packages
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
27 changes: 3 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ concurrency:
cancel-in-progress: true

jobs:
pre-commit:
name: Format
pylint:
name: PyLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: pre-commit/action@v3.0.0
with:
extra_args: --hook-stage manual --all-files
- name: Run PyLint
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
Expand All @@ -34,7 +28,6 @@ jobs:
checks:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
needs: [pre-commit]
strategy:
fail-fast: false
matrix:
Expand All @@ -61,24 +54,10 @@ jobs:
dist:
name: Distribution build
runs-on: ubuntu-latest
needs: [pre-commit]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build sdist and wheel
run: pipx run build

- uses: actions/upload-artifact@v3
with:
path: dist

- name: Check products
run: pipx run twine check dist/*

- uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release' && github.event.action == 'published'
with:
password: ${{ secrets.pypi_password }}
- uses: hynek/build-and-inspect-python-package@v1

0 comments on commit 78b4b42

Please sign in to comment.