chore: slightly simplify release-snapshot.sh

This commit is contained in:
Arnaud Roques 2023-05-12 13:42:34 +02:00
parent 488029b9b0
commit bb33824e87
2 changed files with 19 additions and 17 deletions

View File

@ -1,9 +1,10 @@
#!/usr/bin/env bash
set -ex
find . -name "*.jar"
TAG="snapshot"
DATE_TIME_UTC=$(date -u +"%F at %T (UTC)")
RELEASE_DIR="build/github_release"
gh release delete "${TAG}" -y || true
@ -11,26 +12,26 @@ git tag --force "${TAG}"
git push --force origin "${TAG}"
mkdir "${RELEASE_DIR}"
mkdir "github_release"
ln -s "../publications/maven/module.json" "${RELEASE_DIR}/plantuml-SNAPSHOT-module.json"
ln -s "../publications/maven/pom-default.xml" "${RELEASE_DIR}/plantuml-SNAPSHOT.pom"
ln -s "../libs/plantuml-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml-SNAPSHOT.jar"
ln -s "../libs/plantuml-${RELEASE_VERSION}-javadoc.jar" "${RELEASE_DIR}/plantuml-SNAPSHOT-javadoc.jar"
ln -s "../libs/plantuml-${RELEASE_VERSION}-sources.jar" "${RELEASE_DIR}/plantuml-SNAPSHOT-sources.jar"
ln -s "../libs/plantuml-pdf-${RELEASE_VERSION}.jar" "${RELEASE_DIR}/plantuml-pdf-SNAPSHOT.jar"
cp "build/publications/maven/module.json" "github_release/plantuml-SNAPSHOT-module.json"
cp "build/publications/maven/pom-default.xml" "github_release/plantuml-SNAPSHOT.pom"
cp "build/libs/plantuml-${RELEASE_VERSION}.jar" "github_release/plantuml-SNAPSHOT.jar"
cp "build/libs/plantuml-${RELEASE_VERSION}-javadoc.jar" "github_release/plantuml-SNAPSHOT-javadoc.jar"
cp "build/libs/plantuml-${RELEASE_VERSION}-sources.jar" "github_release/plantuml-SNAPSHOT-sources.jar"
cp "build/libs/plantuml-pdf-${RELEASE_VERSION}.jar" "github_release/plantuml-pdf-SNAPSHOT.jar"
if [[ -e "build/publications/maven/module.json.asc" ]]; then
# signatures are optional so that forked repos can release snapshots without needing a gpg signing key
ln -s "../publications/maven/module.json.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT-module.json.asc"
ln -s "../publications/maven/pom-default.xml.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT.pom.asc"
ln -s "../libs/plantuml-${RELEASE_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT.jar.asc"
ln -s "../libs/plantuml-${RELEASE_VERSION}-javadoc.jar.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT-javadoc.jar.asc"
ln -s "../libs/plantuml-${RELEASE_VERSION}-sources.jar.asc" "${RELEASE_DIR}/plantuml-SNAPSHOT-sources.jar.asc"
ln -s "../libs/plantuml-pdf-${RELEASE_VERSION}.jar.asc" "${RELEASE_DIR}/plantuml-pdf-SNAPSHOT.jar.asc"
cp "build/publications/maven/module.json.asc" "github_release/plantuml-SNAPSHOT-module.json.asc"
cp "build/publications/maven/pom-default.xml.asc" "github_release/plantuml-SNAPSHOT.pom.asc"
cp "build/libs/plantuml-${RELEASE_VERSION}.jar.asc" "github_release/plantuml-SNAPSHOT.jar.asc"
cp "build/libs/plantuml-${RELEASE_VERSION}-javadoc.jar.asc" "github_release/plantuml-SNAPSHOT-javadoc.jar.asc"
cp "build/libs/plantuml-${RELEASE_VERSION}-sources.jar.asc" "github_release/plantuml-SNAPSHOT-sources.jar.asc"
cp "build/libs/plantuml-pdf-${RELEASE_VERSION}.jar.asc" "github_release/plantuml-pdf-SNAPSHOT.jar.asc"
fi
echo -n "${DATE_TIME_UTC}" > "${RELEASE_DIR}/plantuml-SNAPSHOT.timestamp"
echo -n "${DATE_TIME_UTC}" > "github_release/plantuml-SNAPSHOT.timestamp"
cat <<-EOF >notes.txt
## Version ~v${RELEASE_VERSION%-SNAPSHOT} of the ${DATE_TIME_UTC}
@ -44,6 +45,6 @@ gh release create \
--target "${GITHUB_SHA}" \
--title "${TAG} (~v${RELEASE_VERSION%-SNAPSHOT})" \
--notes-file notes.txt \
"${TAG}" ${RELEASE_DIR}/*
"${TAG}" github_release/*
echo "::notice title=release snapshot::Snapshot (~v${RELEASE_VERSION%-SNAPSHOT}) released at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/${TAG} and taken the ${DATE_TIME_UTC}"

View File

@ -126,10 +126,11 @@ jobs:
run: sed -i "s/version = .*/version = $POM_VERSION/" gradle.properties
- name: Build artifacts
run: |
gradle -q clean build \
gradle clean build \
pdfJar \
generateMetadataFileForMavenPublication generatePomFileForMavenPublication \
-x test
find . -name "*.jar"
- name: Sign artifacts
if: env.ORG_GRADLE_PROJECT_signingKey
env: