diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e514ef2..ece690f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -5,7 +5,7 @@ on: branches: - master - develop - pull_request: + pull_request: workflow_dispatch: @@ -22,6 +22,8 @@ jobs: uses: ./.github/workflows/test.yaml lint: uses: ./.github/workflows/lint.yaml + release: + uses: ./.github/workflows/release.yaml # Build job build-docs: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d4341dc --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: Release + +on: + workflow_call: + +jobs: + release: + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/ # Replace with your PyPI project name + permissions: + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + - name: Build + run: python -m build + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: dist + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file