Merge pull request #9 from marcpinet/feat-confusion-matrix #15
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
name: Create Release on Push | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'setup.py' | ||
jobs: | ||
# ... (previous jobs) | ||
release: | ||
needs: check-version-changed | ||
if: needs.check-version-changed.outputs.version_changed == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Ensure all tags are fetched | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Extract Version from setup.py | ||
id: get_version | ||
run: | | ||
echo "VERSION=$(python setup.py --version)" >> $GITHUB_OUTPUT | ||
- name: Get last tag | ||
id: get_last_tag | ||
run: | | ||
echo "LAST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | ||
- name: Create and Push Tag | ||
run: | | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Action" | ||
NEW_TAG="v${{ steps.get_version.outputs.VERSION }}" | ||
git tag $NEW_TAG | ||
git push origin $NEW_TAG | ||
- name: Generate Release Notes | ||
id: generate_release_notes | ||
run: | | ||
NEW_TAG="v${{ steps.get_version.outputs.VERSION }}" | ||
LAST_TAG=${{ steps.get_last_tag.outputs.LAST_TAG }} | ||
RELEASE_NOTES=$(git log $LAST_TAG...$NEW_TAG --pretty=format:"- %s" --reverse) | ||
echo "RELEASE_NOTES=$RELEASE_NOTES" >> $GITHUB_OUTPUT | ||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: "neuralnetlib ${{ steps.get_version.outputs.VERSION }}" | ||
tag_name: ${{ steps.get_version.outputs.VERSION }} | ||
body: ${{ steps.generate_release_notes.outputs.RELEASE_NOTES }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |