-
-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split publish.yaml in tag-release.yaml
- Loading branch information
Showing
4 changed files
with
85 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: prepare release pr | ||
name: Prepare release PR | ||
|
||
on: | ||
workflow_dispatch: | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Tag release | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Release tag version.' | ||
type: string | ||
default: NONE | ||
required: true | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
env: | ||
FORCE_COLOR: "1" | ||
|
||
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
jobs: | ||
# Always build & lint package. | ||
build-package: | ||
name: Build & verify package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: hynek/build-and-inspect-python-package@v2 | ||
|
||
tag: | ||
name: Tag a new release | ||
# tag a release after a release PR was accepted | ||
if: | | ||
github.event_name == 'pull_request' | ||
&& github.event.action == 'closed' | ||
&& github.event.pull_request.merged == true | ||
&& startsWith(github.head_ref, 'release-') | ||
needs: [build-package] | ||
env: | ||
GITHUB_HEAD_REF: ${{ github.head_ref }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Tag the commit | ||
run: | | ||
RELEASE_VERSION=${GITHUB_HEAD_REF#release-} | ||
echo Release version: $RELEASE_VERSION | ||
git config user.name 'subliminal bot' | ||
git config user.email diaoulael@gmail.com | ||
git tag --annotate --message="Release version $RELEASE_VERSION" $RELEASE_VERSION ${{ github.sha }} | ||
git push origin $RELEASE_VERSION |
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