1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 19:09:03 +00:00

Merge pull request #1034 from The-Lum/AddVersionOnSnapshotCI

fix: [CI] Add pseudo version on Snapshot
This commit is contained in:
PlantUML 2022-06-06 20:15:29 +02:00 committed by GitHub
commit 6a51780588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -34,6 +34,7 @@ fi
echo -n "${DATE_TIME_UTC}" > "${RELEASE_DIR}/plantuml-SNAPSHOT.timestamp"
cat <<-EOF >notes.txt
## Version ~v${POM_VERSION%-SNAPSHOT} of the ${DATE_TIME_UTC}
This is a pre-release of [the latest development work](https://github.com/plantuml/plantuml/commits/).
⚠️ **It is not ready for general use** ⚠️
⏱ _Snapshot taken the ${DATE_TIME_UTC}_
@ -42,7 +43,7 @@ EOF
gh release create \
--prerelease \
--target "${GITHUB_SHA}" \
--title "${TAG} (~v${POM_VERSION%-SNAPSHOT} [${DATE_TIME_UTC}])" \
--title "${TAG} (~v${POM_VERSION%-SNAPSHOT})" \
--notes-file notes.txt \
"${TAG}" ${RELEASE_DIR}/*

View File

@ -27,6 +27,9 @@ jobs:
do_snapshot_release: ${{ steps.config.outputs.do_snapshot_release }}
pom_version: ${{ steps.config.outputs.pom_version }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Configure workflow
id: config
env:
@ -59,8 +62,8 @@ jobs:
elif [[ "${GITHUB_EVENT_NAME}" =~ push|workflow_dispatch && "${REF}" == "refs/heads/master" ]]; then
echo "::notice title=::This run will release a snapshot"
echo "::set-output name=do_snapshot_release::true"
v=$(perl -ne 'if (/return (\d{6,7});/) {$v=$1} if (/final int beta = (\d+);/) {$b=$1} END{print(substr($v, 0, 1),".", substr($v, 1, 4),"."); if ($b) {print(int(substr($v+1, 5)), "beta", $b);} else {print(int(substr($v, 5)))}}' src/net/sourceforge/plantuml/version/Version.java)
echo "::set-output name=pom_version::$v-SNAPSHOT" # pom_version is taken from Version.java
V=$(perl -ne 'if (/return (\d{6,7});/) {$v=$1} if (/final int beta = (\d+);/) {$b=$1} END{print(substr($v, 0, 1),".", substr($v, 1, 4),"."); if ($b) {print(int(substr($v+1, 5)), "beta", $b);} else {print(int(substr($v, 5)))}}' src/net/sourceforge/plantuml/version/Version.java)
echo "::set-output name=pom_version::$V-SNAPSHOT" # pom_version is taken from Version.java
else
echo "This run will NOT make a release"