88 # - published
99 # # stable release only
1010 - released
11+ run-name : Post ${{ github.event.release.name }}
1112
1213jobs :
1314 call-publish-docs :
14- runs-on : ubuntu-latest
15- steps :
16- - uses : ./.github/workflows/docs.yaml
15+ uses : ./.github/workflows/docs.yaml
1716 update-version :
1817 permissions :
1918 # write permission is required to update version.py
2019 contents : write
20+ pull-requests : write
2121 runs-on : ubuntu-latest
2222 steps :
2323 - name : Checkout repository
@@ -28,22 +28,46 @@ jobs:
2828 id : update_version
2929 run : |
3030 VERSION=$(echo "${{ github.event.release.name }}" | grep -oP '\d+\.\d+\.\d+')
31- echo "VERSION=$VERSION" >> $GITHUB_ENV
3231 sed -i "s/^__version__ = .*/__version__ = \"$VERSION\"/" datajoint/version.py
32+ cat datajoint/version.py
3333 # Commit the changes
34+ BRANCH_NAME="update-version-$VERSION"
35+ git switch -c $BRANCH_NAME
3436 git config --global user.name "github-actions"
3537 git config --global user.email "github-actions@github.com"
3638 git add datajoint/version.py
3739 git commit -m "Update version.py to $VERSION"
38- git push
40+ git push origin $BRANCH_NAME
41+ echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
42+ echo "VERSION=$VERSION" >> $GITHUB_ENV
43+ - name : Create Pull Request
44+ env :
45+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46+ run : |
47+ gh pr create \
48+ --title "[github-actions]Update version.py to ${{ github.event.release.name }}" \
49+ --body "This PR updates \`version.py\` to match the latest release: ${{ github.event.release.name }}" \
50+ --base master \
51+ --head ${{ env.BRANCH_NAME }} \
52+ --reviewer dimitri-yatsenko,yambottle,ttngu207
3953 slack-notification :
4054 runs-on : ubuntu-latest
4155 steps :
42- - name : Post text to a Slack channel
56+ - name : Post a message in a channel
4357 uses : slackapi/slack-github-action@v2.0.0
4458 with :
45- method : chat.postMessage
46- token : ${{ secrets.SLACK_BOT_TOKEN }}
59+ webhook : ${{ secrets.SLACK_WEBHOOK_URL }}
60+ webhook-type : incoming-webhook
4761 payload : |
48- channel: ${{ secrets.SLACK_CHANNEL_ID }}
49- text: "howdy <@channel>!"
62+ {
63+ "text": "*New Release Published!* :tada: \n*Repository:* ${{ github.repository }}\n*Version:* ${{ github.event.release.tag_name }}\n*URL:* ${{ github.event.release.html_url }}",
64+ "blocks": [
65+ {
66+ "type": "section",
67+ "text": {
68+ "type": "mrkdwn",
69+ "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>"
70+ }
71+ }
72+ ]
73+ }
0 commit comments