Skip to content

Commit

Permalink
Revert "fix: workflows edgecases error and bump version"
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpinet authored Nov 13, 2023
1 parent a1d9490 commit 6f639b1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
- main
paths:
- 'setup.py'
pull_request:
branches:
- "main"
paths:
- 'setup.py'

jobs:
check-version-changed:
Expand All @@ -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
publish:
needs: check-version-changed
if: ${{ env.version_changed == 'true' }}
if: needs.check-version-changed.outputs.version_changed == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out code
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
- main
paths:
- 'setup.py'
pull_request:
branches:
- "main"
paths:
- 'setup.py'

jobs:
check-version-changed:
Expand All @@ -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
Expand All @@ -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 }}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='neuralnetlib',
version='0.4.0',
version='0.3.1',
author='Marc Pinet',
description='A simple neural network library with only numpy as dependency',
long_description=open('README.md', encoding="utf-8").read(),
Expand Down

0 comments on commit 6f639b1

Please sign in to comment.