Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rrekhi1 authored Jun 27, 2024
1 parent e01b4bd commit 90d656f
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release to Maven Central

on:
push:
branches:
- main

jobs:
build-and-release:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true

- name: Import GPG signing key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.MAVEN_SIGNING_KEY }}
passphrase: ${{ secrets.MAVEN_SIGNING_KEY_PASSPHRASE }}

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'

- name: Calculate version
id: calculate-version
uses: bitshifted/git-auto-semver@v1
with:
create_tag: true

- name: Build and Test
run: |
# Replace with your build and test commands
./mvnw clean verify
- name: Release to Maven repo
if: success() # Only run if previous steps were successful
run: |
mvn -P release -Dgpg.keyname=${{ secrets.GPG_KEY_NAME }} \
-Dgpg.passphrase=${{ secrets.MAVEN_SIGNING_KEY_PASSPHRASE }} \
-Drevision=${{ steps.calculate-version.outputs.version-string }} deploy
env:
MVN_CENTRAL_USERNAME: ${{ secrets.MVN_CENTRAL_USERNAME }}
MVN_CENTRAL_PASSWORD: ${{ secrets.MVN_CENTRAL_PASSWORD }}

0 comments on commit 90d656f

Please sign in to comment.