Skip to content

Commit

Permalink
Add github release action. (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
aoli-al authored Feb 4, 2025
1 parent 8621535 commit ce2a70b
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 3 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Publish package to Maven Central and Gradle Plugin Portal
on:
workflow_dispatch:
inputs:
mode:
description: 'staging/snapshot, default is snapshot'
required: true
default: 'snapshot'
jobs:
publish:
runs-on: ${{ matrix.operating-system }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
operating-system: [ macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
cache: 'gradle'
- name: Read and update version
run: |
BASE_VERSION=$(grep "^version=" gradle.properties | cut -d'=' -f2)
if [[ "${{ github.event.inputs.mode }}" == "staging" ]]; then
BASE_VERSION=${BASE_VERSION/-SNAPSHOT/}
fi
echo "VERSION=${BASE_VERSION}" >> $GITHUB_ENV
echo "Version: $BASE_VERSION"
- name: Create jreleaser work directory
run: mkdir -p ./build/jreleaser
- name: build the repository
run: ./gradlew build
- name: publish to github package repository (macOS)
if: runner.os == 'macOS'
run: ./gradlew :jvmti:publish -Pversion=$VERSION
- name: create stage (Linux)
if: runner.os == 'Linux'
run: ./gradlew publish -Pversion=$VERSION
- name: publish to Maven Central
run: ./gradlew jreleaserFullRelease -Pversion=$VERSION
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{secrets.JRELEASER_MAVENCENTRAL_PASSWORD}}
JRELEASER_GPG_PASSPHRASE: ${{secrets.JRELEASER_MAVENCENTRAL_PASSWORD}}
JRELEASER_GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
JRELEASER_GPG_PUBLIC_KEY: ${{secrets.JRELEASER_GPG_PUBLIC_KEY}}
JRELEASER_GPG_SECRET_KEY: ${{secrets.JRELEASER_GPG_SECRET_KEY}}
- name: publish to Gradle Plugins Portal
run: ./gradlew publishPlugins
env:
GRADLE_PUBLISH_KEY: ${{secrets.GRADLE_PUBLISH_SECRET}}
- uses: actions/create-release@v1
if: runner.os == 'Linux' && github.event.inputs.mode == 'staging'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: "Release ${{ env.VERSION }}"
body: |
This release includes the following:
- Version: `${{ env.VERSION }}`
- Published packages are available in Maven central.
draft: false
prerelease: true
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jreleaser {
active.set(Active.ALWAYS)
create("sonatype") {
snapshotSupported = true
stage = Stage.UPLOAD
stage = Stage.FULL
active = Active.ALWAYS
url = "https://central.sonatype.com/api/v1/publisher"
stagingRepository("build/staging-deploy")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
kotlin.code.style=official
group=org.pastalab.fray
version=0.2.0
version=0.2.1
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
2 changes: 1 addition & 1 deletion plugins/gradle/src/main/kotlin/FrayExtension.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package org.pastalab.fray.gradle

open class FrayExtension {
var version = "0.2.0"
var version = "0.2.1"
}

0 comments on commit ce2a70b

Please sign in to comment.