@@ -86,16 +86,25 @@ jobs:
8686 fi
8787 echo "color=$COLOR" >> "$GITHUB_OUTPUT"
8888
89+ - name : Read version from gradle.properties
90+ id : version
91+ run : |
92+ VERSION=$(grep 'jsoncmp.version=' gradle.properties | cut -d= -f2)
93+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
94+
8995 - name : Update README badges
9096 run : |
9197 COVERAGE=${{ needs.test-and-coverage.outputs.coverage }}
9298 COLOR=${{ steps.badge.outputs.color }}
9399 REPO=${{ github.repository }}
100+ VERSION=${{ steps.version.outputs.version }}
94101
95- BUILD_BADGE="[](https://github.com/${REPO}/actions/workflows/main.yml)"
96- COVERAGE_BADGE="[](https://github.com/${REPO}/actions/workflows/main.yml)"
102+ BUILD_BADGE="[](https://github.com/${REPO}/actions/workflows/deploy.yml)"
103+ COVERAGE_BADGE="[](https://github.com/${REPO}/actions/workflows/deploy.yml)"
104+ VERSION_ESCAPED=$(echo "$VERSION" | sed 's/-/--/g')
105+ MAVEN_BADGE="[](https://github.com/${REPO}/packages)"
97106
98- BADGE_LINE="${BUILD_BADGE} ${COVERAGE_BADGE}"
107+ BADGE_LINE="${BUILD_BADGE} ${COVERAGE_BADGE} ${MAVEN_BADGE} "
99108
100109 if grep -q '^\[!\[Build\]' README.md; then
101110 sed -i "1,/^\[!\[Build\]/s|^\[!\[Build\].*|${BADGE_LINE}|" README.md
@@ -105,6 +114,12 @@ jobs:
105114 sed -i "1a\\\\${BADGE_LINE}\n" README.md
106115 fi
107116
117+ - name : Update version in README and docs
118+ run : |
119+ VERSION=${{ steps.version.outputs.version }}
120+ sed -i "s|implementation(\"dev.skymansandy:json-cmp:[^\"]*\")|implementation(\"dev.skymansandy:json-cmp:${VERSION}\")|" README.md
121+ find docs -name '*.md' -exec sed -i "s|implementation(\"dev.skymansandy:json-cmp:[^\"]*\")|implementation(\"dev.skymansandy:json-cmp:${VERSION}\")|" {} +
122+
108123 - name : Commit badge updates
109124 run : |
110125 git config user.name "github-actions[bot]"
@@ -164,3 +179,32 @@ jobs:
164179 - name : Deploy to GitHub Pages
165180 id : deployment
166181 uses : actions/deploy-pages@v4
182+
183+ github-release :
184+ name : GitHub Release
185+ needs : [publish, update-badges]
186+ runs-on : ubuntu-latest
187+ steps :
188+ - uses : actions/checkout@v4
189+
190+ - name : Read version from gradle.properties
191+ id : version
192+ run : |
193+ VERSION=$(grep 'jsoncmp.version=' gradle.properties | cut -d= -f2)
194+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
195+
196+ - name : Create GitHub Release
197+ env :
198+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
199+ run : |
200+ VERSION=${{ steps.version.outputs.version }}
201+ TAG="v${VERSION}"
202+
203+ if gh release view "$TAG" > /dev/null 2>&1; then
204+ echo "Release $TAG already exists, skipping."
205+ else
206+ gh release create "$TAG" \
207+ --title "$TAG" \
208+ --generate-notes \
209+ --target main
210+ fi
0 commit comments