Skip to content

Create Release

Create Release #16

Workflow file for this run

name: Create Release
on:
workflow_dispatch:
push:
# Publish `v1.2.3` tags as releases.
tags:
- v*
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Build with Maven
run: mvn -U -B package
- name: Create Changelog
shell: bash
run: |
DIFF=$(git log $(git tag --sort=-creatordate | sed '2q;d')..HEAD --oneline)
if [ -z "$DIFF" ]; then
echo "Defaulting to full log"
DIFF=$(git log --oneline)
fi
echo "# Commits since last release" > CHANGELOG.txt
echo "$DIFF" | sed 's/^/* /' | sed '/Auto-Update Dependencies/{s/Updated/\n\t* Updated/g}' | sed '/\[maven-release-plugin\]/d' | sed -r '/.*\(#\w+\)$/d' >> CHANGELOG.txt
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
body_path: CHANGELOG.txt
generate_release_notes: true
files: |
target/timesheetgenerator.jar