This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
Merge pull request #20 from shaishap/main #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy - maven central | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Apache Maven Central | |
uses: actions/setup-java@v3 | |
with: # configure settings.xml | |
distribution: 'temurin' | |
java-version: '11' | |
server-id: ossrh | |
server-username: OSSRH_USER | |
server-password: OSSRH_PASSWORD | |
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }} | |
gpg-passphrase: GPG_PASSPHRASE | |
- name: Build and Publish to Apache Maven Central | |
run: mvn clean deploy | |
env: | |
OSSRH_USER: ${{ secrets.ORG_OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} | |
GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }} | |
- name: Get package version | |
run: | | |
git config --global user.email "${ACTOR_EMAIL}" | |
git config --global user.name "${ACTOR_NAME}" | |
PKG_VER=$(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout) | |
echo "VER=$PKG_VER" | |
git tag -d "$PKG_VER" || true | |
git push origin --delete "$PKG_VER" || true | |
git tag -a -m "auto-created by CI" "$PKG_VER" | |
git push origin --tags | |
env: | |
ACTOR_NAME: ${{ github.event.pusher.name }} | |
ACTOR_EMAIL: ${{ github.event.pusher.email }} | |
GH_TOKEN: ${{ github.token }} |