PRERELEASE: v1.15.2-pre1 #98
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HMS Networks Solution Center | |
# Build Outputs Action for Maven-based Ewon ETK Project Releases | |
# Version: 2.2 | |
# | |
# This action is configured to automatically run when a release | |
# tag is created in the following syntax: `v*`. | |
name: Release (Build Outputs) | |
on: | |
push: | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CHANGELOG_FILE_NAME: web-docs/docs/02-CHANGELOG.mdx | |
RELEASE_ZIP_INCLUDED: README.md LICENSE src .classpath .project pom.xml build.xml starting-files | |
RELEASE_JAR_NAME_REGEX: '*-full.jar' | |
RELEASE_JAVADOCS_NAME_REGEX: '*-javadoc.jar' | |
RELEASE_BODY_FILE: RELEASE-BODY.md | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set Up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: 16 | |
- name: Cache local Maven repository | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2/repository | |
target/buildJdk | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Compile Java Files With Maven | |
run: mvn package -f pom.xml | |
- name: Ensure \\r\\n line endings in jvmrun | |
run: | | |
sudo apt-get install dos2unix -y | |
unix2dos ./starting-files/jvmrun | |
- name: Build Release Archive | |
run: | | |
zip release -r $RELEASE_ZIP_INCLUDED $(find target -name $RELEASE_JAR_NAME_REGEX) $(find target -name $RELEASE_JAVADOCS_NAME_REGEX) | |
- name: Extract version number from tag name | |
run: echo "VERSION_NUMBER=$(cut -d 'v' -f2- <<< ${{ github.ref }})" >> $GITHUB_ENV | |
# gets substring of github.ref after and including 'v', for example refs/tags/v1.0.0 results in v1.0.0 | |
- name: Extract version-specific change list from CHANGELOG.md | |
run: | | |
grep -Pzo "(?<=##\sVersion\s$VERSION_NUMBER[\r\n])((.|\r|\n|\r\n)*?(?=##\sVersion.*)|(.|\r|\n|\r\z)*)" $CHANGELOG_FILE_NAME >> $RELEASE_BODY_FILE.tmp | |
tr -d '\0' < $RELEASE_BODY_FILE.tmp > $RELEASE_BODY_FILE | |
# gets section of changelog between (not including) version-specific header and next version header using regex look-back and look-ahead and removes trailing NULL characters | |
- name: Get Name of Release (RepoName-Version) | |
run: echo "RELEASE_NAME=${{ github.event.repository.name }}-${{ env.VERSION_NUMBER }}" >> $GITHUB_ENV | |
- name: Rename Release File(s) (Append Repo Name and Version Number) | |
run: | | |
mv release.zip ${{ env.RELEASE_NAME }}.zip | |
- name: Check if Tag SEMVER indicates a Pre-Release Build | |
id: check_pre_release | |
run: | | |
# Check if SEMVER indicates a pre-release (has a hyphen after MAJOR.MINOR.PATCH) | |
if [[ ${{ env.VERSION_NUMBER }} =~ ^[0-9]+\.[0-9]+\.[0-9]+(-\S+)$ ]]; then | |
echo "IS_PRE_RELEASE=true" >> $GITHUB_ENV | |
else | |
echo "IS_PRE_RELEASE=false" >> $GITHUB_ENV | |
fi | |
- name: Create Release in Repository Releases | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
target_commitish: ${{ github.sha }} | |
name: Release ${{ env.VERSION_NUMBER }} | |
draft: false | |
prerelease: ${{ steps.check_pre_release.outputs.IS_PRE_RELEASE }} | |
generate_release_notes: false | |
body_path: ${{ env.RELEASE_BODY_FILE }} | |
files: | | |
./starting-files/* | |
${{ env.ARTIFACT_PATHNAME }} | |
${{ env.RELEASE_NAME }}.zip |