Post Release 0.14.4 #5
Workflow file for this run
This file contains hidden or 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: Post Release | |
| on: | |
| # Once draft release is released, trigger the docs release | |
| release: | |
| types: | |
| ## pre-release and stable release | |
| #- published | |
| ## stable release only | |
| - released | |
| run-name: Post ${{ github.event.release.name }} | |
| jobs: | |
| call-publish-docs: | |
| uses: ./.github/workflows/docs.yaml | |
| update-version: | |
| permissions: | |
| # write permission is required to update version.py | |
| contents: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update version.py | |
| id: update_version | |
| run: | | |
| VERSION=$(echo "${{ github.event.release.name }}" | grep -oP '\d+\.\d+\.\d+') | |
| sed -i "s/^__version__ = .*/__version__ = \"$VERSION\"/" datajoint/version.py | |
| cat datajoint/version.py | |
| # Commit the changes | |
| BRANCH_NAME="update-version-$VERSION" | |
| git checkout -b $BRANCH_NAME | |
| git config --global user.name "github-actions" | |
| git config --global user.email "github-actions@github.com" | |
| git add datajoint/version.py | |
| git commit -m "Update version.py to $VERSION" | |
| git push origin $BRANCH_NAME | |
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ env.BRANCH_NAME }} | |
| title: "Update version.py to ${{ github.event.release.name }}" | |
| body: "This PR updates `version.py` to match the latest release: ${{ github.event.release.name }}" | |
| base: master | |
| slack-notification: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Post a message in a channel | |
| uses: slackapi/slack-github-action@v2.0.0 | |
| with: | |
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: | | |
| { | |
| "text": "*New Release Published!* :tada: \n*Repository:* ${{ github.repository }}\n*Version:* ${{ github.event.release.tag_name }}\n*URL:* ${{ github.event.release.html_url }}", | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "*New Release Published!* :tada:\n*Repository:* ${{ github.repository }}\n*Version:* ${{ github.event.release.tag_name }}\n*URL:* <${{ github.event.release.html_url }}|View Release>" | |
| } | |
| } | |
| ] | |
| } |