Skip to content

Commit 175c275

Browse files
author
Drew Yang
committed
fix: 🐛 slack notification
1 parent 166b6d5 commit 175c275

File tree

2 files changed

+35
-11
lines changed

2 files changed

+35
-11
lines changed

.github/workflows/post_release.yaml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ on:
88
#- published
99
## stable release only
1010
- released
11+
run-name: Post ${{ github.event.release.name }}
1112

1213
jobs:
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 "[email protected]"
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/[email protected]
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+
}

datajoint/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# version bump auto managed by Github Actions:
22
# label_prs.yaml(prep), release.yaml(bump), post_release.yaml(edit)
33
# manually set this version will be eventually overwritten by the above actions
4-
__version__ = "0.14.4"
4+
__version__ = "0.14.3"
55

66
assert len(__version__) <= 10 # The log table limits version to the 10 characters

0 commit comments

Comments
 (0)