mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-26 23:06:30 +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
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
do_release: ${{ steps.config.outputs.do_release }}
|
do_release: ${{ steps.config.outputs.do_release }}
|
||||||
|
do_snapshot_release: ${{ steps.config.outputs.do_snapshot_release }}
|
||||||
pom_version: ${{ steps.config.outputs.pom_version }}
|
pom_version: ${{ steps.config.outputs.pom_version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Configure workflow
|
- 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.
|
# 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)
|
# (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" && \
|
if [[ "${GITHUB_EVENT_NAME}" == "create" && "${REF_TYPE}" == "tag" && "${REF}" == v* && \
|
||||||
"${REF_TYPE}" == "tag" && \
|
|
||||||
"${REF}" == v* && \
|
|
||||||
( "${ACTOR}" == "arnaudroques" || "${ACTOR}" == "${GITHUB_REPOSITORY_OWNER}" ) \
|
( "${ACTOR}" == "arnaudroques" || "${ACTOR}" == "${GITHUB_REPOSITORY_OWNER}" ) \
|
||||||
]]; then
|
]]; 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=do_release::true"
|
||||||
echo "::set-output name=pom_version::${REF#v}" # pom_version is the tag without the 'v' prefix
|
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
|
else
|
||||||
echo "This run will NOT make a release"
|
echo "This run will NOT make a release"
|
||||||
fi
|
fi
|
||||||
@ -88,8 +92,7 @@ jobs:
|
|||||||
if: needs.workflow_config.outputs.do_release == 'true'
|
if: needs.workflow_config.outputs.do_release == 'true'
|
||||||
env:
|
env:
|
||||||
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
|
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
|
||||||
run: |
|
run: mvn --batch-mode versions:set "-DnewVersion=${POM_VERSION}"
|
||||||
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
|
# Compile / Test / Package are separate steps so the reason for any failure is more obvious in GitHub UI
|
||||||
- name: Compile
|
- name: Compile
|
||||||
@ -99,11 +102,11 @@ jobs:
|
|||||||
run: mvn --batch-mode test
|
run: mvn --batch-mode test
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
if: ${{ matrix.release_from_this_build }}
|
if: matrix.release_from_this_build
|
||||||
run: mvn --batch-mode -Dmaven.test.skip=true package
|
run: mvn --batch-mode -DfinalName=plantuml -Dmaven.test.skip=true package
|
||||||
|
|
||||||
- name: Upload jar artifacts
|
- name: Upload jar artifacts
|
||||||
if: ${{ matrix.release_from_this_build }}
|
if: matrix.release_from_this_build
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
# Using github.run_number here to reduce confusion when downloading & comparing artifacts from several builds
|
# Using github.run_number here to reduce confusion when downloading & comparing artifacts from several builds
|
||||||
@ -122,7 +125,7 @@ jobs:
|
|||||||
|
|
||||||
release:
|
release:
|
||||||
needs: [ workflow_config, build ]
|
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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
@ -133,13 +136,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: ${{ github.run_number }}-jars
|
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
|
- name: Create release in GitHub
|
||||||
|
if: needs.workflow_config.outputs.do_release == 'true'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
|
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
|
||||||
TAG: ${{ github.event.ref }}
|
TAG: ${{ github.event.ref }}
|
||||||
run: |
|
run: .github/scripts/release.sh
|
||||||
gh release create "${TAG}" \
|
|
||||||
"plantuml-${POM_VERSION}.jar" \
|
|
||||||
"plantuml-${POM_VERSION}-javadoc.jar" \
|
|
||||||
"plantuml-${POM_VERSION}-sources.jar"
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -58,6 +58,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
<maven.compiler.target>1.7</maven.compiler.target>
|
<maven.compiler.target>1.7</maven.compiler.target>
|
||||||
<maven.compiler.testSource>1.8</maven.compiler.testSource>
|
<maven.compiler.testSource>1.8</maven.compiler.testSource>
|
||||||
@ -131,6 +132,7 @@
|
|||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>${finalName}</finalName>
|
||||||
<sourceDirectory>${project.basedir}/src</sourceDirectory>
|
<sourceDirectory>${project.basedir}/src</sourceDirectory>
|
||||||
<testSourceDirectory>${project.basedir}/test</testSourceDirectory>
|
<testSourceDirectory>${project.basedir}/test</testSourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user