-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Github workflow] Add new tag on version.py update (#685)
* Add release workflow
- Loading branch information
1 parent
8561680
commit b8e04ba
Showing
2 changed files
with
78 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
## Workflow to check CHANGELOG was updated when version gets updated in share/version.py | ||
name: changelog | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'share/version.py' | ||
|
||
jobs: | ||
|
||
changelog: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Get version number | ||
shell: bash | ||
run: | | ||
VERSION=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+(\-[a-zA-Z]+[0-9]+)?' share/version.py) | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
echo "::notice::ESF version is $VERSION." | ||
- name: Check changelog | ||
shell: bash | ||
run: | | ||
first_line=$(awk 'NR==1' CHANGELOG.md) | ||
if [[ $first_line != *" v${{ env.VERSION }} "* ]]; then | ||
error="CHANGELOG should contain the new version in its first line, like this ' v1.1.1 '." | ||
reminder="Do not forget to add space before and after the version in the CHANGELOG first line." | ||
echo "::error::$error $reminder" | ||
exit 1 | ||
fi |
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,41 @@ | ||
--- | ||
## Workflow to create a new git tag if version.py variable version gets updated | ||
name: release | ||
|
||
permissions: | ||
contents: write # write permission is required to create a GitHub release | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
paths: | ||
- 'share/version.py' | ||
|
||
jobs: | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Get version number | ||
shell: bash | ||
run: | | ||
VERSION=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+(\-[a-zA-Z]+[0-9]+)?' share/version.py) | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
echo "::notice::ESF version is $VERSION." | ||
- name: Create tag | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/lambda-v' + ${{ env.VERSION }}, | ||
sha: context.sha | ||
}) |