8
8
# - published
9
9
# # stable release only
10
10
- released
11
+ run-name : Post ${{ github.event.release.name }}
11
12
12
13
jobs :
13
14
call-publish-docs :
14
- runs-on : ubuntu-latest
15
- steps :
16
- - uses : ./.github/workflows/docs.yaml
15
+ uses : ./.github/workflows/docs.yaml
17
16
update-version :
18
17
permissions :
19
18
# write permission is required to update version.py
20
19
contents : write
20
+ pull-requests : write
21
21
runs-on : ubuntu-latest
22
22
steps :
23
23
- name : Checkout repository
@@ -28,22 +28,46 @@ jobs:
28
28
id : update_version
29
29
run : |
30
30
VERSION=$(echo "${{ github.event.release.name }}" | grep -oP '\d+\.\d+\.\d+')
31
- echo "VERSION=$VERSION" >> $GITHUB_ENV
32
31
sed -i "s/^__version__ = .*/__version__ = \"$VERSION\"/" datajoint/version.py
32
+ cat datajoint/version.py
33
33
# Commit the changes
34
+ BRANCH_NAME="update-version-$VERSION"
35
+ git switch -c $BRANCH_NAME
34
36
git config --global user.name "github-actions"
35
37
git config --global user.email "[email protected] "
36
38
git add datajoint/version.py
37
39
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
39
53
slack-notification :
40
54
runs-on : ubuntu-latest
41
55
steps :
42
- - name : Post text to a Slack channel
56
+ - name : Post a message in a channel
43
57
44
58
with :
45
- method : chat.postMessage
46
- token : ${{ secrets.SLACK_BOT_TOKEN }}
59
+ webhook : ${{ secrets.SLACK_WEBHOOK_URL }}
60
+ webhook-type : incoming-webhook
47
61
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