Skip to content

Commit

Permalink
Add a script to create release PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasPerkins1123 committed Apr 17, 2024
1 parent 0532e13 commit 90cc544
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .github/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

REPO="diffblue/cover-github-action"
BRANCH_NAME="release/$1"
PR_TITLE="Release $1"
PR_BODY="Update Diffblue Cover to $1"

git checkout -b "$BRANCH_NAME"

sed -i "s/cli:[0-9]\{4\}\.[0-9]\{2\}\.[0-9]\{2\}-jdk/cli:$1-jdk/g" Dockerfile

./build.sh
git add Dockerfile
git add */Dockerfile
git commit -m "Bump docker image to $1"

git push origin "$BRANCH_NAME"

curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"title": "'"$PR_TITLE"'", "body": "'"$PR_BODY"'", "head": "'"$BRANCH_NAME"'", "base": "main"}' \
"https://api.github.com/repos/$REPO/pulls"
4 changes: 2 additions & 2 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create release
if: contains(github.event.head_commit.message, '/Release/')
if: contains(github.event.head_commit.message, '/release/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION_NUMBER=$(echo "${{github.event.head_commit.message}}" | sed -n 's/.*Release\/\([0-9]\{4\}\.[0-9]\{2\}\.[0-9]\{2\}\).*/\1/p')
VERSION_NUMBER=$(echo "${{github.event.head_commit.message}}" | sed -n 's/.*release\/\([0-9]\{4\}\.[0-9]\{2\}\.[0-9]\{2\}\).*/\1/p')
if [ -n "$VERSION_NUMBER" ]; then
gh release create "v$VERSION_NUMBER" --repo="$GITHUB_REPOSITORY" --title="v$VERSION_NUMBER" --generate-notes
else
Expand Down

0 comments on commit 90cc544

Please sign in to comment.