-
Notifications
You must be signed in to change notification settings - Fork 8
feat: design another workflow that does (pre) release on GitHub with tag push - use reusable snippets #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
119bcdd
07ce93b
bc8551c
8dc3379
637ce0b
1e1852d
83da7b8
1cf8721
07a0330
a4b130a
60ea9bf
c105346
18d4dbc
1106e0b
fc8b6f5
f87a158
1fb0c37
a4816bb
2411c3c
bde12b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Internal reusable workflow for deleting and creating a new tag. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Compile news items into CHANGELOG.rst | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| update_changelog_result: | ||
| description: 'Whether the previous update-changelog job succeeded' | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| delete-create-new-tag: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Fail delete-create-new-tag job if CHANGELOG update failed | ||
| run: | | ||
| if [ "${{ inputs.update_changelog_result }}" == 'success' ]; then | ||
| echo "Ready to delete and create new tag containing the latest CHANGELOG.rst update in the main branch..." | ||
| else | ||
| echo "Previous update-changelog job failed; exiting..." | ||
| exit 1 | ||
| fi | ||
| - name: Checkout the repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: main | ||
| - name: Delete the tag | ||
| run: | | ||
| git fetch --tags | ||
| git tag -d "${{ github.ref_name }}" | ||
| git push origin ":${{ github.ref_name }}" | ||
| - name: Create a new tag (Expect commit SHA to match with that of main branch) | ||
| run: | | ||
| git tag "${{ github.ref_name }}" | ||
| git push origin "${{ github.ref_name }}" |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Internal reusable workflow for GH pre-release |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| name: Pre-release on GitHub | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| github-pre-release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Generate GH release notes for pre-release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| prerelease: true | ||
| generate_release_notes: true | ||
| token: ${{ secrets.GITHUB_TOKEN }} |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Internal reusable workflow for GH release |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Release on GitHub | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| delete-create-new-tag-result: | ||
| description: 'Whether the previous delete-create-new-tag job succeeded' | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| github-release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Fail github-release job if CHANGELOG update failed | ||
| run: | | ||
| if [ "${{ inputs.delete-create-new-tag-result }}" == 'success' ]; then | ||
| echo "Ready to release on GitHub..." | ||
| else | ||
| echo "Previous update-changelog job failed; exiting..." | ||
| exit 1 | ||
| fi | ||
| - name: Checkout the repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: main | ||
| - name: Generate GH release notes for release | ||
| run: | | ||
| wget https://raw.githubusercontent.com/scikit-package/release-scripts/v0/.github/workflows/get-latest-changelog.py | ||
| python get-latest-changelog.py "${{ github.ref_name }}" | ||
| - name: Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| body_path: CHANGELOG.txt | ||
| token: ${{ secrets.GITHUB_TOKEN }} |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Main workflow for releasing on GH based on tag - This is the main feature introduced in this PR |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Release on GitHub with tag pushed to remote repository | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| maintainer_github_username: | ||
| description: GitHub username authorized to start GitHub/PyPI release' | ||
| required: true | ||
| type: string | ||
| secrets: | ||
| PAT_TOKEN: | ||
| description: 'GitHub Personal Access Token' | ||
| required: true | ||
|
|
||
| jobs: | ||
| tag-privilege-check: | ||
| uses: ./.github/workflows/_release_tag_privilege_check.yml | ||
| with: | ||
| maintainer_github_username: ${{ inputs.maintainer_github_username }} | ||
|
|
||
| update-changelog: | ||
| if: "always() && !contains(github.ref, 'rc')" | ||
| needs: [tag-privilege-check] | ||
| uses: ./.github/workflows/_update_changelog.yml | ||
| secrets: | ||
| PAT_TOKEN: ${{ secrets.PAT_TOKEN }} | ||
|
|
||
| delete-create-new-tag: | ||
| # Please see the comments provided in _build-whel-release-upload.yml | ||
| if: "always() && !contains(github.ref, 'rc')" | ||
| needs: [update-changelog] | ||
| uses: ./.github/workflows/_delete_create_tag.yml | ||
| with: | ||
| update_changelog_result: ${{ needs.update-changelog.result }} | ||
|
|
||
| github-pre-release: | ||
| if: "always() && contains(github.ref, 'rc')" | ||
| needs: [tag-privilege-check] | ||
| uses: ./.github/workflows/_github_pre_release.yml | ||
|
|
||
|
|
||
| github-release: | ||
| if: "always() && !contains(github.ref, 'rc')" | ||
| needs: [delete-create-new-tag] | ||
| uses: ./.github/workflows/_github_release.yml | ||
| with: | ||
| delete-create-new-tag-result: ${{ needs.delete-create-new-tag.result }} |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Internal reusable workflow for compiling changelog |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Compile news items into CHANGELOG.rst | ||
|
|
||
| on: | ||
| workflow_call: | ||
| secrets: | ||
| PAT_TOKEN: | ||
| description: 'GitHub Personal Access Token' | ||
| required: true | ||
|
|
||
| jobs: | ||
| update-changelog: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout the repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.ref }} | ||
| token: ${{ secrets.PAT_TOKEN }} | ||
|
|
||
| - name: Update CHANGELOG.rst with the latest news | ||
| run: | | ||
| wget https://raw.githubusercontent.com/scikit-package/release-scripts/v0/.github/workflows/update-changelog.py | ||
| python update-changelog.py "${{ github.ref_name }}" | ||
| rm update-changelog.py | ||
|
|
||
| - name: Commit the changes in CHANGELOG.rst | ||
| uses: stefanzweifel/git-auto-commit-action@v5 | ||
| with: | ||
| commit_message: update changelog | ||
| branch: main |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| **Added:** | ||
|
|
||
| * Author _release-on-github-on-tag-push.yml to release on GitHub with tag push. | ||
|
|
||
| **Changed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Deprecated:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Removed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Fixed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Security:** | ||
|
|
||
| * <news item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor existing
build-wheel-releaseworkflow via reusable workflows