Skip to content

Commit

Permalink
Improved the publishing workflow where you simply pick the type of ve…
Browse files Browse the repository at this point in the history
…rsion bump.
  • Loading branch information
gerak-cz committed Apr 26, 2024
1 parent 9e15b2a commit 6930c66
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
8 changes: 8 additions & 0 deletions .github/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
release:
title-prefix: 'v'
tag-prefix: 'v'
initial-version: '0.1.0'
body-when-empty-changes: 'Changes not compiled before version 1.'
branch:
base-branch: 'main'
create-major-version-branch: false
34 changes: 19 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,41 @@ name: Publish
on:
workflow_dispatch:
inputs:
major_version:
description: 'Major version'
version_bump:
description: 'Select version bump'
required: true
type: number
minor_version:
description: 'Minor version'
required: true
type: number
patch_version:
description: 'Patch version'
required: true
type: number
type: choice
options:
- major
- minor
- patch
default: 'minor'

jobs:
publish:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Publish to Maven
- name: Bump version
id: bump_version
uses: MeilCli/bump-release-action@v2
with:
config_path: '.github/bump.yml'
bump: ${{ github.event.inputs.version_bump }}

- name: Publish to Maven Central
env:
MAJOR_VERSION: ${{ github.event.inputs.major_version }}
MINOR_VERSION: ${{ github.event.inputs.minor_version }}
PATCH_VERSION: ${{ github.event.inputs.patch_version }}
NEXT_VERSION: ${{ steps.bump_version.outputs.next_version }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }}
Expand Down
6 changes: 1 addition & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ subprojects {
apply<DokkaPlugin>()
apply<MavenPublishPlugin>()

val majorVersion = System.getenv("MAJOR_VERSION") ?: "0"
val minorVersion = System.getenv("MINOR_VERSION") ?: "1"
val patchVersion = System.getenv("PATCH_VERSION") ?: "0"

group = "io.github.cleverlance.linguine"
version = "$majorVersion.$minorVersion.$patchVersion"
version = System.getenv("NEXT_VERSION") ?: "0.1.0"

mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
Expand Down

0 comments on commit 6930c66

Please sign in to comment.