try to fix prerelease conditional part 2 (#15) #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish release | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
pypi-publish: | |
runs-on: ubuntu-latest | |
environment: pypi-release | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pdm-project/setup-pdm@v3 | |
- name: Setup | |
run: | | |
python3 -m pip install pdm-bump | |
pdm sync --dev | |
- name: Build | |
run: pdm build | |
- name: Update git release tag | |
id: tagger | |
run: | | |
git config --global user.name 'Auto' | |
git config --global user.email '[email protected]' | |
pdm bump tag && git push --tags | |
tag=$( pdm show --version ) | |
tag_is_full_release=$( [[ "${tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+\$ ]] && echo 'TRUE' || echo 'FALSE' ) | |
echo "tag=${tag}" >> "$GITHUB_OUTPUT" | |
echo "full-release=${tag_is_full_release}" | |
- name: Test and get reports | |
run: pdm reports | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
id: gh-release | |
with: | |
prerelease: ${{ steps.tagger.full-release == 'FALSE' }} | |
automatic_release_tag: ${{ steps.tagger.tag }} | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
files: | | |
dist/* | |
badges/*.svg | |
- name: Publish package distributions to PyPI | |
run: pdm publish --no-build |