Skip to content

Commit be37885

Browse files
Merge pull request #20 from mindfiredigital/master
Merge master into main
2 parents 8451e97 + 6325c19 commit be37885

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

.github/workflows/release-and-publish.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
permissions:
1313
contents: write
1414
id-token: write
15+
pull-requests: write
1516
steps:
1617
- name: Checkout code
1718
uses: actions/checkout@v3
@@ -29,15 +30,32 @@ jobs:
2930
python -m pip install --upgrade pip
3031
pip install build twine python-semantic-release setuptools-scm
3132
33+
- name: Create release branch
34+
run: |
35+
git config --global user.name "github-actions"
36+
git config --global user.email "github-actions@github.com"
37+
git checkout -b release-branch
38+
3239
- name: Run semantic-release
3340
env:
3441
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3542
run: |
36-
git config --global user.name "github-actions"
37-
git config --global user.email "github-actions@github.com"
3843
semantic-release version
3944
semantic-release publish
4045
46+
- name: Push release branch
47+
run: git push origin release-branch
48+
49+
- name: Create PR to main
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
run: |
53+
gh pr create \
54+
--base main \
55+
--head release-branch \
56+
--title "Automated Release Updates" \
57+
--body "This pull request contains updates from the semantic-release process." || true
58+
4159
- name: Build package
4260
run: python -m build
4361

@@ -69,22 +87,15 @@ jobs:
6987
env:
7088
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7189
run: |
72-
# Fetch the latest from master
7390
git fetch origin master:refs/remotes/origin/master
74-
75-
# Check if there are differences between main and master
7691
DIFF_COUNT=$(git rev-list --count origin/master..HEAD)
77-
7892
if [ "$DIFF_COUNT" -gt 0 ]; then
7993
echo "Differences found between main and master. Creating PR..."
80-
81-
# Use GitHub CLI to create the PR
8294
gh pr create \
8395
--base master \
8496
--head main \
8597
--title "Sync master with main after release" \
8698
--body "This is an automated PR to sync changes from main back to master after a release." || true
87-
8899
echo "Pull request created or already exists."
89100
else
90101
echo "No differences found between main and master. Skipping PR creation."

0 commit comments

Comments
 (0)