Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔀 Merge origin/122-update-github-action-for-deployment into origin/dev #126

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/publish-and-deploy-to-maven-central.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
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 }}
61 changes: 0 additions & 61 deletions .github/workflows/publish-to-maven-central.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .releaserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ plugins:
- changelogFile: CHANGELOG.md
- - "@semantic-release/exec"
- prepareCmd: "./mvnw versions:set -DnewVersion=${nextRelease.version}"
publishCmd: "./mvnw deploy -s ./settings.xml"
- "@semantic-release/github"
- - "@semantic-release/git"
- assets:
- CHANGELOG.md
- pom.xml
message: "🔖 Update `package.json` to `${nextRelease.version}` [skip release]\n\n${nextRelease.notes}"
message: "🔖 Update `package.json` to `${nextRelease.version}` [skip release]\n\n${nextRelease.notes}"
Loading