Skip to content

Commit

Permalink
Auto-update SNAPSHOT version in Wiki on commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgecrw committed Jun 30, 2023
1 parent b812c59 commit 97c3c21
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,22 @@ jobs:
with:
gradle-version: 8.1.1
arguments: publish

- name: Check out Wiki source data
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}.wiki
path: markdown

- name: Update and publish Wiki SNAPSHOT link
run: |
xmlResult=$(wget -qO- https://oss.sonatype.org/content/repositories/snapshots/com/fazecast/jSerialComm/${{ steps.gitversion.outputs.version }}-SNAPSHOT/maven-metadata.xml)
snapshot=$(echo $xmlResult | grep -o "<snapshot>.*</snapshot>")
timestamp=$(echo $snapshot | grep -o "<timestamp>.*</timestamp>" | grep -o "[0-9][^<]*")
buildNumber=$(echo $snapshot | grep -o "<buildNumber>.*</buildNumber>" | grep -o "[0-9][^<]*")
cd markdown
sed -i "s@\*\*Snapshot Version\*\*:.*@\*\*Snapshot Version\*\*: \*${{ steps.gitversion.outputs.version }}-SNAPSHOT\* ([[Download JAR file here|https://oss.sonatype.org/content/repositories/snapshots/com/fazecast/jSerialComm/${{ steps.gitversion.outputs.version }}-SNAPSHOT/jSerialComm-${{ steps.gitversion.outputs.version }}-$timestamp-$buildNumber.jar]])@" Home.md
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git diff-index --quiet HEAD || git commit -m "New SNAPSHOT version" && git push

0 comments on commit 97c3c21

Please sign in to comment.