| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0711683 commit 1cd5393
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,17 +3,19 @@ name: Release | |||
| 3 | 3 | on: | |
| 4 | 4 | push: | |
| 5 | 5 | branches: [main] | |
| 6 | + release: | ||
| 7 | + types: [published] | ||
| 6 | 8 | workflow_dispatch: | |
| 7 | 9 | ||
| 8 | 10 | # ┌─────────────────────────────────────────────────────────────────┐ | |
| 9 | 11 | # │ DRAFT_RELEASE │ | |
| 10 | 12 | # │ │ | |
| 11 | - # │ "true" → GitHub Releases are created as drafts and PyPI │ | ||
| 12 | - # │ publishing is skipped (burn-in / review period). │ | ||
| 13 | - # │ "false" → GitHub Releases are published immediately and the │ | ||
| 14 | - # │ package is uploaded to PyPI. │ | ||
| 13 | + # │ "true" → GitHub Releases are created as drafts; review them │ | ||
| 14 | + # │ on GitHub, then click "Publish" to trigger PyPI. │ | ||
| 15 | + # │ "false" → GitHub Releases are published immediately, which │ | ||
| 16 | + # │ automatically triggers the PyPI publish job. │ | ||
| 15 | 17 | # │ │ | |
| 16 | - # │ Flip to "false" once you have verified the release output. │ | ||
| 18 | + # │ Flip to "false" once you are comfortable with the pipeline. │ | ||
| 17 | 19 | # └─────────────────────────────────────────────────────────────────┘ | |
| 18 | 20 | env: | |
| 19 | 21 | DRAFT_RELEASE: "true" | |
@@ -22,9 +24,7 @@ jobs: | |||
| 22 | 24 | release: | |
| 23 | 25 | name: Semantic Release | |
| 24 | 26 | runs-on: ubuntu-latest | |
| 25 | - if: >- | ||
| 26 | - github.event_name == 'workflow_dispatch' || | ||
| 27 | - !startsWith(github.event.head_commit.message, 'chore(release):') | ||
| 27 | + if: github.event_name != 'release' | ||
| 28 | 28 | concurrency: | |
| 29 | 29 | group: release | |
| 30 | 30 | cancel-in-progress: false | |
@@ -51,11 +51,21 @@ jobs: | |||
| 51 | 51 | uses: python-semantic-release/python-semantic-release@v9 | |
| 52 | 52 | with: | |
| 53 | 53 | github_token: ${{ secrets.GITHUB_TOKEN }} | |
| 54 | + vcs_release: "false" | ||
| 54 | 55 | ||
| 55 | 56 | - name: Build package | |
| 56 | 57 | if: steps.release.outputs.released == 'true' | |
| 57 | 58 | run: python -m build | |
| 58 | 59 | ||
| 60 | + - name: Extract changelog for this release | ||
| 61 | + if: steps.release.outputs.released == 'true' | ||
| 62 | + id: changelog | ||
| 63 | + run: | | ||
| 64 | + TAG="${{ steps.release.outputs.tag }}" | ||
| 65 | + VER="${TAG#v}" | ||
| 66 | + # Extract the section between this version's header and the next | ||
| 67 | + awk "/^## v${VER//./\\.} /{found=1; next} /^## v[0-9]/{if(found) exit} found" CHANGELOG.md > /tmp/release_notes.md | ||
| 68 | + | ||
| 59 | 69 | - name: Create GitHub Release | |
| 60 | 70 | if: steps.release.outputs.released == 'true' | |
| 61 | 71 | env: | |
@@ -67,11 +77,39 @@ jobs: | |||
| 67 | 77 | gh release create "${{ steps.release.outputs.tag }}" \ | |
| 68 | 78 | ${DRAFT_FLAG:-} \ | |
| 69 | 79 | --title "${{ steps.release.outputs.tag }}" \ | |
| 70 | - --generate-notes \ | ||
| 80 | + --notes-file /tmp/release_notes.md \ | ||
| 71 | 81 | dist/* | |
| 72 | 82 | ||
| 73 | - - name: Publish to PyPI | ||
| 83 | + - name: Publish to PyPI (non-draft) | ||
| 74 | 84 | if: steps.release.outputs.released == 'true' && env.DRAFT_RELEASE != 'true' | |
| 75 | 85 | uses: pypa/gh-action-pypi-publish@release/v1 | |
| 76 | 86 | with: | |
| 77 | 87 | skip-existing: true | |
| 88 | + | ||
| 89 | + pypi-publish: | ||
| 90 | + name: Publish to PyPI | ||
| 91 | + runs-on: ubuntu-latest | ||
| 92 | + if: github.event_name == 'release' && github.event.action == 'published' | ||
| 93 | + permissions: | ||
| 94 | + id-token: write | ||
| 95 | + steps: | ||
| 96 | + - name: Checkout | ||
| 97 | + uses: actions/checkout@v4 | ||
| 98 | + with: | ||
| 99 | + ref: ${{ github.event.release.tag_name }} | ||
| 100 | + | ||
| 101 | + - name: Set up Python | ||
| 102 | + uses: actions/setup-python@v5 | ||
| 103 | + with: | ||
| 104 | + python-version: '3.12' | ||
| 105 | + | ||
| 106 | + - name: Install build tools | ||
| 107 | + run: python -m pip install -U pip build | ||
| 108 | + | ||
| 109 | + - name: Build package | ||
| 110 | + run: python -m build | ||
| 111 | + | ||
| 112 | + - name: Publish to PyPI | ||
| 113 | + uses: pypa/gh-action-pypi-publish@release/v1 | ||
| 114 | + with: | ||
| 115 | + skip-existing: true | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments