Skip to content

Release

Release #50

Workflow file for this run

# This workflow release a new version of the app, after a successful build of main
name: Release
on:
workflow_run:
workflows: ["Maven verify"]
types: [completed]
branches:
- 'main'
concurrency:
group: maven-${{ github.event.workflow_run.head_sha }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
cache: maven
- name: Restore cached build output
id: cache-output-restore
uses: actions/cache/restore@v3
with:
path: target
key: build-output-${{ github.event.workflow_run.head_sha }}
- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
branch: ${{ github.event.workflow_run.head_sha }}
- id: get-repository-name
run: echo "name=${VAR,,}" >> $GITHUB_OUTPUT
env:
VAR: ${{ github.repository }}
- name: Build image to GHCR using jib
run: mvn -B jib:build
-Djib.to.image=ghcr.io/${{ steps.get-repository-name.outputs.name }}:${{ steps.semver.outputs.next }}
-Djib.to.auth.username=${{ github.actor }}
-Djib.to.auth.password=${{ github.token }}
- name: Generate CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ github.event.workflow_run.head_sha }}
toTag: ${{ steps.semver.outputs.current }}
writeToFile: false
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: true
tag: ${{ steps.semver.outputs.next }}
commit: ${{ github.event.workflow_run.head_sha }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}