diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62d24d0..af9b62b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,10 @@ name: Release package on: - release: + push: # On push to these prerelease branches + branches: + - v2 + release: # On create a GitHub Release types: - created workflow_dispatch: @@ -11,7 +14,7 @@ jobs: runs-on: ubuntu-latest environment: name: pypi - url: https://pypi.org/p/ + url: https://pypi.org/p/asdf-pydantic/ permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing @@ -24,7 +27,16 @@ jobs: python -m pip install --upgrade pip python -m pip install hatch hatch env create + echo "ASDF_PYDANTIC_VERSION=$(hatch version)" >> $GITHUB_ENV - name: Build run: hatch build + - name: Create GitHub Release (prerelease only) + if: github.event.push + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag: ${{ env.ASDF_PYDANTIC_VERSION }} + files: dist/* + generate_release_notes: true - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1