Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp #35

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Temp #35

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/scripts/release.sh
Original file line number Diff line number Diff line change
@@ -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 "${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} 🎉"
24 changes: 24 additions & 0 deletions .github/scripts/release_snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -ex

cat <<-EOF >notes.txt
This is a pre-release of the latest development work.
⚠️ **It is not ready for general use** ⚠️
EOF

gh release delete snapshot -y || true

git tag --force snapshot

git push --force origin snapshot

mv plantuml.jar plantuml-SNAPSHOT.jar
mv plantuml-javadoc.jar plantuml-SNAPSHOT-javadoc.jar
mv plantuml-sources.jar plantuml-SNAPSHOT-sources.jar

gh release create --prerelease --target "${GITHUB_SHA}" --title snapshot --notes-file notes.txt snapshot \
plantuml-SNAPSHOT.jar \
plantuml-SNAPSHOT-javadoc.jar \
plantuml-SNAPSHOT-sources.jar

echo "::notice title=::Snapshot released at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/snapshot"
41 changes: 24 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- master
- snapshot-release
workflow_dispatch:

defaults:
Expand All @@ -18,6 +19,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
Expand All @@ -42,14 +44,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/snapshot-release" ]]; 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
Expand All @@ -61,8 +66,8 @@ jobs:
strategy:
fail-fast: false
matrix:
java_version: [ 8, 11, 17 ]
os: [ macos-10.15, macos-11, ubuntu-18.04, ubuntu-20.04, windows-2016, windows-2019, windows-2022 ]
# java_version: [ 8, 11, 17 ]
# os: [ macos-10.15, macos-11, ubuntu-18.04, ubuntu-20.04, windows-2016, windows-2019, windows-2022 ]
include:
- release_from_this_build: true
os: ubuntu-20.04
Expand All @@ -88,8 +93,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
Expand All @@ -99,11 +103,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
Expand All @@ -112,7 +116,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
Expand All @@ -123,13 +127,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 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
</parent>

<properties>
<finalName>${artifactId}-${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>
Expand Down Expand Up @@ -131,6 +132,7 @@
</developers>

<build>
<finalName>${finalName}</finalName>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<testSourceDirectory>${project.basedir}/test</testSourceDirectory>
<resources>
Expand Down
1 change: 1 addition & 0 deletions temp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bar