-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "fix: workflows edgecases error and bump version"
- Loading branch information
Showing
3 changed files
with
24 additions
and
14 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
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 |
---|---|---|
|
@@ -6,6 +6,11 @@ on: | |
- main | ||
paths: | ||
- 'setup.py' | ||
pull_request: | ||
branches: | ||
- "main" | ||
paths: | ||
- 'setup.py' | ||
|
||
jobs: | ||
check-version-changed: | ||
|
@@ -18,18 +23,18 @@ jobs: | |
- name: Check if version changed | ||
id: version-change | ||
run: | | ||
VERSION_CHANGE=$(git diff $(git rev-parse HEAD~1) $(git rev-parse HEAD) -- setup.py | grep -e "^+.*version.*=" -e "^-.*version.*=" | wc -l) | ||
VERSION_CHANGE=$(git diff HEAD^ HEAD -- setup.py | grep -e "^+.*version.*=" -e "^-.*version.*=" | wc -l) | ||
if [ "$VERSION_CHANGE" -eq 0 ]; then | ||
echo "Version not changed" | ||
echo "version_changed=false" >> $GITHUB_ENV | ||
echo "::set-output name=version_changed::false" | ||
else | ||
echo "Version changed" | ||
echo "version_changed=true" >> $GITHUB_ENV | ||
echo "::set-output name=version_changed::true" | ||
fi | ||
release: | ||
needs: check-version-changed | ||
if: ${{ env.version_changed == 'true' }} | ||
if: needs.check-version-changed.outputs.version_changed == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
|
@@ -41,17 +46,17 @@ jobs: | |
- name: Extract Version from setup.py | ||
id: get_version | ||
run: | | ||
echo "VERSION=$(python setup.py --version)" >> $GITHUB_ENV | ||
echo "::set-output name=VERSION::$(python setup.py --version)" | ||
- name: Create and Push Tag | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git tag v${{ env.VERSION }} | ||
git push origin v${{ env.VERSION }} | ||
git tag v${{ steps.get_version.outputs.VERSION }} | ||
git push origin v${{ steps.get_version.outputs.VERSION }} | ||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: neuralnetlib v${{ env.VERSION }} | ||
tag_name: v${{ env.VERSION }} | ||
name: neuralnetlib v${{ steps.get_version.outputs.VERSION }} | ||
tag_name: v${{ steps.get_version.outputs.VERSION }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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