Skip to content

Commit

Permalink
chore: add release sdk action (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohnoor94 authored Sep 9, 2024
1 parent 6223983 commit 1e158f8
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/release-sdk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release an SDK to Maven Central

on:
workflow_dispatch:
inputs:
version:
description: |
The version to release.
Add -SNAPSHOT to release a snapshot version.
required: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
server-id: oss-sonatype
server-username: SONATYPE_USERNAME
server-password: SONATYPE_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
settings-path: ${{ github.workspace }}

- name: Prepare Environment and Version
id: prepare
run: |
git config user.name s-github-actions
git config user.email [email protected]
echo "branch_name=release/${{ inputs.version }}" >> $GITHUB_OUTPUT
- name: Prepare Release
id: prepare_release
run: |
cd code
git checkout -b ${{ steps.prepare.outputs.branch_name }}
chmod a+x ../gradlew && ../gradlew --no-daemon versionsSet -Pversion=${{ inputs.version }}
git add gradle.properties ../gradlew
git commit -m "chore: prepare release ${{ inputs.version }}"
git push --set-upstream origin ${{ steps.prepare.outputs.branch_name }}
- name: Build and Publish
env:
ARTYLAB_USER: ${{ secrets.SONATYPE_USERNAME }}
ARTYLAB_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
run: |
echo "Publishing version ${{ inputs.version }}"
cd code
../gradlew --no-daemon clean jar build publish -Pversion=${{ inputs.version }}

0 comments on commit 1e158f8

Please sign in to comment.