Skip to content

Commit

Permalink
fix lin error
Browse files Browse the repository at this point in the history
  • Loading branch information
dvviktordelev committed Nov 11, 2024
1 parent d8089a8 commit 36aa81b
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/release-post-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Post-Merge Release Actions

on:
pull_request:
types: [closed]
branches:
- 'main'

env:
GITHUB_USER: "datavisyn-bot"
GITHUB_TOKEN: ${{ secrets.DATAVISYN_BOT_REPO_TOKEN }}

jobs:
post_release:
if: ${{ github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'Release') }}
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}

- name: Generate Release Notes
id: generate-release-notes
run: |
TAG_NAME="v$(echo "${{ github.event.pull_request.title }}" | awk '{print $2}')"
response=$(curl -s -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
-d "$(jq -n --arg tag_name "$TAG_NAME" \
--arg target_commitish "main" \
'{tag_name: $tag_name, target_commitish: $target_commitish}')")
echo "$response" | jq -r '.body' > release_notes.txt
- name: Create GitHub Release
run: |
TAG_NAME="v$(echo "${{ github.event.pull_request.title }}" | awk '{print $2}')"
RELEASE_NOTES=$(cat release_notes.txt)
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository.full_name }}/releases \
-d '{
"tag_name": "'"$TAG_NAME"'",
"target_commitish": "main",
"name": "'"$TAG_NAME"'",
"body": "'"$RELEASE_NOTES"'",
"draft": false,
"prerelease": false
}'
- name: Merge Main into Develop
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "<>"
git checkout develop
git pull origin main
git push origin develop
- name: Update Package Version for Next Development Cycle
run: |
CURRENT_VERSION=$(jq -r '.version' package.json)
NEW_VERSION=$(echo "$CURRENT_VERSION" | awk -F. -v OFS=. '{$NF += 1 ; print $0"-SNAPSHOT"}')
jq --arg new_version "$NEW_VERSION" '.version = $new_version' package.json > tmp.json && mv tmp.json package.json
git add package.json
git commit -m "Bump to $NEW_VERSION"
git push origin develop

0 comments on commit 36aa81b

Please sign in to comment.