Skip to content

Commit 3eb0e52

Browse files
committed
fix: protecting the main branch and pr will create the new releases after testing
1 parent 150885b commit 3eb0e52

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

.github/workflows/java.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build and Deploy Java Parser
22

33
on:
44
push:
5-
branches: [develop]
5+
branches: [develop, main]
66
tags: ['v*']
77

88
jobs:
@@ -48,6 +48,13 @@ jobs:
4848
BASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//')
4949
mvn versions:set -DnewVersion="${BASE_VERSION}-SNAPSHOT" -DgenerateBackupPoms=false
5050
51+
- name: Set release version (main branch)
52+
if: github.ref == 'refs/heads/main'
53+
run: |
54+
cd java
55+
BASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//')
56+
mvn versions:set -DnewVersion="${BASE_VERSION}" -DgenerateBackupPoms=false
57+
5158
- name: Set release version (tag)
5259
if: startsWith(github.ref, 'refs/tags/v')
5360
run: |
@@ -74,7 +81,7 @@ jobs:
7481
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
7582

7683
- name: Deploy Release to Central Portal
77-
if: startsWith(github.ref, 'refs/tags/v')
84+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
7885
run: cd java && mvn clean deploy
7986
env:
8087
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}

.github/workflows/js.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build and Deploy JS Parser
22

33
on:
44
push:
5-
branches: [develop]
5+
branches: [develop, main]
66
tags: ['v*']
77

88
jobs:
@@ -37,6 +37,15 @@ jobs:
3737
env:
3838
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
3939

40+
- name: Set release version and publish (main branch)
41+
if: github.ref == 'refs/heads/main'
42+
run: |
43+
cd js
44+
echo "Publishing version: $(node -p "require('./package.json').version")"
45+
npm publish --access public
46+
env:
47+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
48+
4049
- name: Set release version and publish (tag)
4150
if: startsWith(github.ref, 'refs/tags/v')
4251
run: |

.github/workflows/python.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build and Deploy Python Parser
22

33
on:
44
push:
5-
branches: [develop]
5+
branches: [develop, main]
66
tags: ['v*']
77

88
jobs:
@@ -31,6 +31,13 @@ jobs:
3131
sed -i "s/version=\"[^\"]*\"/version=\"${DEV_VERSION}\"/" setup.py
3232
echo "Publishing version: ${DEV_VERSION}"
3333
34+
- name: Set release version (main branch)
35+
if: github.ref == 'refs/heads/main'
36+
run: |
37+
cd python
38+
BASE_VERSION=$(grep -oP 'version="\K[0-9]+\.[0-9]+\.[0-9]+' setup.py)
39+
echo "Publishing version: ${BASE_VERSION}"
40+
3441
- name: Set release version (tag)
3542
if: startsWith(github.ref, 'refs/tags/v')
3643
run: |

0 commit comments

Comments
 (0)