Skip to content

Commit

Permalink
adding release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlangrose committed Jul 2, 2024
1 parent 43a0acb commit 2d2e666
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
on:
push:
name: Release
jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black ruff
- name: Autoformat with black
run: |
black .
- name: Lint with ruff
run: |
ruff check . --fix
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: style fixes by ruff and autoformatting by black"
make_sdist:
needs: ["linting"]
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build SDist
run: |
pip install build
python -m build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
release-please:
runs-on: ubuntu-latest
needs: ["linting", "make_sdist"]
if: github.ref == 'refs/heads/main'
steps:
- uses: GoogleCloudPlatform/release-please-action@v4
id: release
with:
release-type: python
package-name: loopsolver
version-file: loopsolver/version.py
outputs:
release_created: ${{ steps.release.outputs.release_created }}

upload_to_pypi:
runs-on: "ubuntu-latest"
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
verbose: true

0 comments on commit 2d2e666

Please sign in to comment.