Skip to content

🔀 Merge origin/dev into origin/alpha (#94) #63

🔀 Merge origin/dev into origin/alpha (#94)

🔀 Merge origin/dev into origin/alpha (#94) #63

---
name: Publish and deploy package to maven central
on:
push:
branches:
- main
- beta
- alpha
- dev
jobs:
publish-new-version:
name: Publish new version
runs-on: ubuntu-latest
environment: publisher
outputs:
new_release_published: ${{ steps.semantic-release.outputs.new_release_published }}
steps:
- name: Create GitHub app token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false
- name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: temurin
cache: maven
- name: Publish version
uses: cycjimmy/semantic-release-action@v4
id: semantic-release
with:
extra_plugins: |
@semantic-release/exec
semantic-release-gitmoji
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}
deploy-package-to-maven-central:
name: Deploy package to Maven Central
needs: publish-new-version
runs-on: ubuntu-latest
environment: deployment
if: needs.publish-new-version.outputs.new_release_published == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.ref }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: temurin
cache: maven
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Deploy package
run: ./mvnw deploy -s ./settings.xml
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}