From 3cb21182898235346178b9ff8b3a941aaffd69e0 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 29 Dec 2023 10:27:45 -1000 Subject: [PATCH] fix: release process (#18) --- .github/workflows/ci.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db85419..bee197b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,25 +62,39 @@ jobs: release: runs-on: ubuntu-latest environment: release - if: github.ref == 'refs/heads/main' + concurrency: release + permissions: + id-token: write + contents: write needs: - test - lint - commitlint steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - # Run semantic release: # - Update CHANGELOG.md # - Update version in code # - Create git tag # - Create GitHub release # - Publish to PyPI - - name: Python Semantic Release + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.head_ref || github.ref_name }} + + # Do a dry run of PSR + - name: Test release + uses: python-semantic-release/python-semantic-release@v8.7.0 + if: github.ref_name != 'main' + with: + root_options: --noop + + # On main branch: actual PSR + upload to PyPI & GitHub + - name: Release uses: python-semantic-release/python-semantic-release@v8.7.0 + id: release + if: github.ref_name == 'main' with: github_token: ${{ secrets.GITHUB_TOKEN }}