mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-26 14:56:28 +00:00
Merge pull request #767 from matthew16550/snapshot-release
Update CI to create snapshot releases in GitHub
This commit is contained in:
commit
4b84114cd2
13
.github/scripts/release.sh
vendored
Executable file
13
.github/scripts/release.sh
vendored
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
mv plantuml.jar "plantuml-${POM_VERSION}.jar"
|
||||
mv plantuml-javadoc.jar "plantuml-${POM_VERSION}-javadoc.jar"
|
||||
mv plantuml-sources.jar "plantuml-${POM_VERSION}-sources.jar"
|
||||
|
||||
gh release create --target "${GITHUB_SHA}" "${TAG}" \
|
||||
"plantuml-${POM_VERSION}.jar" \
|
||||
"plantuml-${POM_VERSION}-javadoc.jar" \
|
||||
"plantuml-${POM_VERSION}-sources.jar"
|
||||
|
||||
echo "::notice title=::Released at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/${TAG} 🎉"
|
26
.github/scripts/release_snapshot.sh
vendored
Executable file
26
.github/scripts/release_snapshot.sh
vendored
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
TAG="snapshot"
|
||||
|
||||
gh release delete "${TAG}" -y || true
|
||||
|
||||
git tag --force "${TAG}"
|
||||
|
||||
git push --force origin "${TAG}"
|
||||
|
||||
mv plantuml.jar plantuml-SNAPSHOT.jar
|
||||
mv plantuml-javadoc.jar plantuml-SNAPSHOT-javadoc.jar
|
||||
mv plantuml-sources.jar plantuml-SNAPSHOT-sources.jar
|
||||
|
||||
cat <<-EOF >notes.txt
|
||||
This is a pre-release of the latest development work.
|
||||
⚠️ **It is not ready for general use** ⚠️
|
||||
EOF
|
||||
|
||||
gh release create --prerelease --target "${GITHUB_SHA}" --notes-file notes.txt "${TAG}" \
|
||||
plantuml-SNAPSHOT.jar \
|
||||
plantuml-SNAPSHOT-javadoc.jar \
|
||||
plantuml-SNAPSHOT-sources.jar
|
||||
|
||||
echo "::notice title=::Snapshot released at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/${TAG}"
|
36
.github/workflows/ci.yml
vendored
36
.github/workflows/ci.yml
vendored
@ -18,6 +18,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
do_release: ${{ steps.config.outputs.do_release }}
|
||||
do_snapshot_release: ${{ steps.config.outputs.do_snapshot_release }}
|
||||
pom_version: ${{ steps.config.outputs.pom_version }}
|
||||
steps:
|
||||
- name: Configure workflow
|
||||
@ -42,14 +43,17 @@ jobs:
|
||||
# Do a release when a git tag starting with 'v' has been created by a suitable user.
|
||||
# (We match against github.repository_owner as a kludge so that forked repos can release themselves when testing the workflow)
|
||||
|
||||
if [[ "${GITHUB_EVENT_NAME}" == "create" && \
|
||||
"${REF_TYPE}" == "tag" && \
|
||||
"${REF}" == v* && \
|
||||
if [[ "${GITHUB_EVENT_NAME}" == "create" && "${REF_TYPE}" == "tag" && "${REF}" == v* && \
|
||||
( "${ACTOR}" == "arnaudroques" || "${ACTOR}" == "${GITHUB_REPOSITORY_OWNER}" ) \
|
||||
]]; then
|
||||
echo "📣 This run will release '${REF}'"
|
||||
echo "::notice title=::This run will release '${REF}'"
|
||||
echo "::set-output name=do_release::true"
|
||||
echo "::set-output name=pom_version::${REF#v}" # pom_version is the tag without the 'v' prefix
|
||||
|
||||
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"
|
||||
|
||||
else
|
||||
echo "This run will NOT make a release"
|
||||
fi
|
||||
@ -88,8 +92,7 @@ jobs:
|
||||
if: needs.workflow_config.outputs.do_release == 'true'
|
||||
env:
|
||||
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
|
||||
run: |
|
||||
mvn --batch-mode versions:set "-DnewVersion=${POM_VERSION}"
|
||||
run: mvn --batch-mode versions:set "-DnewVersion=${POM_VERSION}"
|
||||
|
||||
# Compile / Test / Package are separate steps so the reason for any failure is more obvious in GitHub UI
|
||||
- name: Compile
|
||||
@ -99,11 +102,11 @@ jobs:
|
||||
run: mvn --batch-mode test
|
||||
|
||||
- name: Package
|
||||
if: ${{ matrix.release_from_this_build }}
|
||||
run: mvn --batch-mode -Dmaven.test.skip=true package
|
||||
if: matrix.release_from_this_build
|
||||
run: mvn --batch-mode -DfinalName=plantuml -Dmaven.test.skip=true package
|
||||
|
||||
- name: Upload jar artifacts
|
||||
if: ${{ matrix.release_from_this_build }}
|
||||
if: matrix.release_from_this_build
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
# Using github.run_number here to reduce confusion when downloading & comparing artifacts from several builds
|
||||
@ -122,7 +125,7 @@ jobs:
|
||||
|
||||
release:
|
||||
needs: [ workflow_config, build ]
|
||||
if: needs.workflow_config.outputs.do_release == 'true'
|
||||
if: needs.workflow_config.outputs.do_release == 'true' || needs.workflow_config.outputs.do_snapshot_release == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
@ -133,13 +136,16 @@ jobs:
|
||||
with:
|
||||
name: ${{ github.run_number }}-jars
|
||||
|
||||
- name: Create snapshot release
|
||||
if: needs.workflow_config.outputs.do_snapshot_release == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
run: .github/scripts/release_snapshot.sh
|
||||
|
||||
- name: Create release in GitHub
|
||||
if: needs.workflow_config.outputs.do_release == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
|
||||
TAG: ${{ github.event.ref }}
|
||||
run: |
|
||||
gh release create "${TAG}" \
|
||||
"plantuml-${POM_VERSION}.jar" \
|
||||
"plantuml-${POM_VERSION}-javadoc.jar" \
|
||||
"plantuml-${POM_VERSION}-sources.jar"
|
||||
run: .github/scripts/release.sh
|
||||
|
2
pom.xml
2
pom.xml
@ -58,6 +58,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<maven.compiler.testSource>1.8</maven.compiler.testSource>
|
||||
@ -131,6 +132,7 @@
|
||||
</developers>
|
||||
|
||||
<build>
|
||||
<finalName>${finalName}</finalName>
|
||||
<sourceDirectory>${project.basedir}/src</sourceDirectory>
|
||||
<testSourceDirectory>${project.basedir}/test</testSourceDirectory>
|
||||
<resources>
|
||||
|
Loading…
Reference in New Issue
Block a user