Skip to content

Release

Release #18

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
jobs:
precheck:
name: Precheck
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.vars.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Version
id: vars
shell: bash
run: |
VERSION=${{ github.event.inputs.version }}
./mvnw -B versions:set versions:commit -DnewVersion=$VERSION
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Action"
git commit -a -m "Releasing version $VERSION"
git push origin main
assemble:
needs: [ precheck ]
uses: jagodevreede/sdkman-ui/.github/workflows/assemble-native.yml@main
with:
project-version: ${{ needs.precheck.outputs.VERSION }}
build-sha: 'main'
release:
needs: [ precheck, assemble ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
merge-multiple: true
path: sdkman-ui/target/
- name: Release
uses: jreleaser/release-action@v2
with:
arguments: full-release
env:
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.VERSION }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: JReleaser output
if: always()
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
- name: Set next snapshot version
id: vars
shell: bash
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Action"
sed -i 's/v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/v${{ github.event.inputs.VERSION }}/g; s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.zip/${{ github.event.inputs.VERSION }}.zip/g' README.md
git add README.md
git commit -m "Updating download links to version ${{ github.event.inputs.VERSION }}"
./mvnw -B versions:set versions:commit -DnextSnapshot=true
git commit -a -m "Preparing for next snapshot version"
git push origin main