File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,25 @@ jobs:
1212 - name : Checkout Repository
1313 uses : actions/checkout@v4
1414
15- - name : Get current version from package.json
15+ - name : Get version from package.json
1616 id : package_version
1717 run : echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
1818
19+ - name : Get latest GitHub tag
20+ id : latest_tag
21+ run : |
22+ LATEST_TAG=$(git ls-remote --tags origin | awk -F'/' '{print $3}' | sort -V | tail -n1)
23+ echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
24+
25+ - name : Compare versions
26+ id : compare_versions
27+ run : |
28+ if [ "${{ env.VERSION }}" != "${{ env.LATEST_TAG }}" ]; then
29+ echo "VERSION_CHANGED=true" >> $GITHUB_ENV
30+ else
31+ echo "VERSION_CHANGED=false" >> $GITHUB_ENV
32+ fi
33+
1934 - name : Check if a PR already exists
2035 id : check_pr
2136 run : |
2540 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2641
2742 - name : Create Pull Request
28- if : env.PR_EXISTS == '0'
43+ if : env.VERSION_CHANGED == 'true' && env. PR_EXISTS == '0'
2944 uses : peter-evans/create-pull-request@v5
3045 with :
3146 title : " 🚀 Release v${{ env.VERSION }}"
You can’t perform that action at this time.
0 commit comments