Skip to content

Create release

Create release #5

Workflow file for this run

name: Create release
# Creating maven and github release
on:
workflow_dispatch:
inputs:
release-version: # id of input
description: "override default release version e.g. with 0.1.0-1"
required: false
permissions:
contents: write
env:
RELEASE_VERSION: ${{ github.event.inputs.release-version }}
IMAGE_NAME: odp-adapter
DOCKERHUB_USERNAME: starwit
DOCKERHUB_ORG: starwitorg
jobs:
build:
name: "Creating maven and github release"
runs-on: [self-hosted, linux, X64]
steps:
- name: Install GH CLI
uses: dev-hanz-ops/[email protected]
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.2
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm --version
- run: node --version
- run: mvn --version
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Maven release pepare
run: |
git config --global user.email "[email protected]"
git config --global user.name "Starwit"
if [ ! -z "${{ env.RELEASE_VERSION }}" ]
then
echo "new version manually set to ${{ env.RELEASE_VERSION }}"
mvn -B build-helper:parse-version versions:set -DnewVersion=${{ env.RELEASE_VERSION }}-SNAPSHOT versions:commit --settings .github/workflows/settings.xml --file pom.xml
fi
echo "mvn generate-sources --file pom.xml"
mvn generate-sources --file pom.xml
echo "git add ."
git add .
modifications=$(git status | grep "modified" || true)
if [ ! -z "$modifications" ]
then
echo "modifications found: $modifications"
git commit -m "modified changelog"
git push
fi
mvn -B release:clean release:prepare -Darguments="-DskipTests" --file pom.xml
mvn -B release:clean --file pom.xml
env:
CI: false
PRIVATE_REPO_USERNAME: ${{ vars.PRIVATE_REPO_USERNAME }}
MAVEN_REPO_READ: ${{ secrets.MAVEN_REPO_READ }}
- name: Get tag name
run: |
echo "TAG=$( git describe --abbrev=0 )" >> $GITHUB_ENV
- name: Create github release
run: gh release create ${{ env.TAG }} -F CHANGELOG.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout tag
run: |
git checkout ${{ env.TAG }}
- name: Build with Maven
run: mvn clean -B package --file pom.xml
env:
CI: false
PRIVATE_REPO_USERNAME: ${{ vars.PRIVATE_REPO_USERNAME }}
MAVEN_REPO_READ: ${{ secrets.MAVEN_REPO_READ }}