Skip to content

release

release #9

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to release from ?"
required: true
default: "main"
release-version:
description: "Release version ?"
required: true
release-tag:
description: "Release tag ?"
required: true
development-version:
description: "Next Development version ?"
required: true
jobs:
release:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Setup git user
uses: fregante/setup-git-user@v2
- name: Set up JDK 17 and OSSRH auth / GPG signing
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
cache: "maven"
server-id: "central"
server-username: CENTRAL_USERNAME
server-password: CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.gpg_private_key }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Perform maven release
run: >
mvn -B -ntp release:prepare release:perform
-DreleaseVersion=${{ github.event.inputs.release-version }}
-DdevelopmentVersion=${{ github.event.inputs.development-version }}
-Dtag=${{ github.event.inputs.release-tag }}
-Darguments="-DskipTests -ntp"
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.gpg_passphrase }}
CENTRAL_USERNAME: ${{ secrets.sonatype_username }}
CENTRAL_PASSWORD: ${{ secrets.sonatype_password }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for image
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=${{inputs.release-version}}
type=sha
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: ./microservice
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.release-tag }}
draft: false
prerelease: false
generate_release_notes: true