update setup py version to 1.0.1 (#68) #7
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 Tag and Draft Release with Notes | |
on: | |
push: | |
branches: | |
- trunk | |
paths: | |
- 'setup.py' | |
workflow_dispatch: | |
jobs: | |
check-and-extract: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get-version.outputs.version }} | |
tag-exists: ${{ steps.check-tag.outputs.exists }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Extract version from setup.py | |
id: get-version | |
run: | | |
VERSION=$(cat setup.py | grep -E '^ +version="[0-9.]+",' | cut -d'"' -f2) | |
echo "Extracted version is $VERSION" | |
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
- name: Check if tag exists | |
id: check-tag | |
run: | | |
if git tag | grep -q "${{ steps.get-version.outputs.version }}"; then | |
echo "Tag exists" | |
echo "exists=1" >> "$GITHUB_OUTPUT" | |
else | |
echo "Tag does not exist" | |
echo "exists=0" >> "$GITHUB_OUTPUT" | |
fi | |
create-tag-and-release: | |
needs: check-and-extract | |
if: needs.check-and-extract.outputs.tag-exists == '0' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Create and push tag | |
run: | | |
git config --global user.name "GitHub Action" | |
git config --global user.email "action@github.com" | |
git tag "v${{ needs.check-and-extract.outputs.version }}" | |
git push origin "v${{ needs.check-and-extract.outputs.version }}" | |
- name: Draft a new release with autogenerated notes | |
run: | | |
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" | |
gh release create "v${{ needs.check-and-extract.outputs.version }}" --title "Release v${{ needs.check-and-extract.outputs.version }}" --generate-notes --draft |