Skip to content

Commit 36aa81b

Browse files
committed
fix lin error
1 parent d8089a8 commit 36aa81b

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Post-Merge Release Actions
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- 'main'
8+
9+
env:
10+
GITHUB_USER: "datavisyn-bot"
11+
GITHUB_TOKEN: ${{ secrets.DATAVISYN_BOT_REPO_TOKEN }}
12+
13+
jobs:
14+
post_release:
15+
if: ${{ github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'Release') }}
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: Checkout Repository
19+
uses: actions/checkout@v4
20+
with:
21+
token: ${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
22+
23+
- name: Generate Release Notes
24+
id: generate-release-notes
25+
run: |
26+
TAG_NAME="v$(echo "${{ github.event.pull_request.title }}" | awk '{print $2}')"
27+
response=$(curl -s -X POST \
28+
-H "Accept: application/vnd.github+json" \
29+
-H "Authorization: Bearer $GITHUB_TOKEN" \
30+
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
31+
-d "$(jq -n --arg tag_name "$TAG_NAME" \
32+
--arg target_commitish "main" \
33+
'{tag_name: $tag_name, target_commitish: $target_commitish}')")
34+
echo "$response" | jq -r '.body' > release_notes.txt
35+
36+
- name: Create GitHub Release
37+
run: |
38+
TAG_NAME="v$(echo "${{ github.event.pull_request.title }}" | awk '{print $2}')"
39+
RELEASE_NOTES=$(cat release_notes.txt)
40+
curl -X POST \
41+
-H "Authorization: token $GITHUB_TOKEN" \
42+
-H "Accept: application/vnd.github.v3+json" \
43+
https://api.github.com/repos/${{ github.repository.full_name }}/releases \
44+
-d '{
45+
"tag_name": "'"$TAG_NAME"'",
46+
"target_commitish": "main",
47+
"name": "'"$TAG_NAME"'",
48+
"body": "'"$RELEASE_NOTES"'",
49+
"draft": false,
50+
"prerelease": false
51+
}'
52+
53+
- name: Merge Main into Develop
54+
run: |
55+
git config user.name "$GITHUB_ACTOR"
56+
git config user.email "<>"
57+
git checkout develop
58+
git pull origin main
59+
git push origin develop
60+
61+
- name: Update Package Version for Next Development Cycle
62+
run: |
63+
CURRENT_VERSION=$(jq -r '.version' package.json)
64+
NEW_VERSION=$(echo "$CURRENT_VERSION" | awk -F. -v OFS=. '{$NF += 1 ; print $0"-SNAPSHOT"}')
65+
jq --arg new_version "$NEW_VERSION" '.version = $new_version' package.json > tmp.json && mv tmp.json package.json
66+
67+
git add package.json
68+
git commit -m "Bump to $NEW_VERSION"
69+
git push origin develop

0 commit comments

Comments
 (0)