diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 199e237..8b3e1df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,23 +1,34 @@ -name: Create Release on Merge +name: Release on: - pull_request: - types: [closed] + push: + branches: + - main jobs: - release: - if: > - github.event.pull_request.merged == true && - github.base_ref == 'main' && - github.head_ref == 'develop' + pypi-publish: + name: upload release to PyPI runs-on: ubuntu-latest - + # Specifying a GitHub environment is optional, but strongly encouraged + environment: release + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write steps: - - name: Create Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: - tag_name: ${{ github.event.pull_request.title }} - release_name: ${{ github.event.pull_request.title }} - body: ${{ github.event.pull_request.body }} + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + shell: bash + run: pip install -r requirements_dev.txt + + - name: Build the project + shell: bash + run: python -m build . + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1