Skip to content

Commit

Permalink
ci: publish snapshot action
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandrfedorov97 committed Apr 2, 2024
1 parent b96fa69 commit b8ff4f0
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish SNAPSHOT

on:
workflow_dispatch:

jobs:
artifact:
environment: production
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Get Info
run: |
echo "version=$(awk '/<version>/,/<\/version>/' pom.xml | head -n 1 | sed 's/^[[:space:]]*//g' | sed -n 's:.*<version>\(.*\)</version>.*:\1:p')" >> $GITHUB_OUTPUT
echo "artifact=$(awk '/<artifactId>/,/<\/artifactId>/' pom.xml | head -n 1 | sed 's/^[[:space:]]*//g' | sed -n 's:.*<artifactId>\(.*\)</artifactId>.*:\1:p')" >> $GITHUB_OUTPUT
id: info
- name: Check SNAPSHOT version
if: ${{ !endsWith(steps.info.outputs.version, '-SNAPSHOT') }}
run: |
echo "Version from pom.xml does not match template SNAPSHOT!"
exit 1
- name: Install Java 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Submodules update
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
- name: Publish to the Maven Central Repository
run: |
mvn --no-transfer-progress --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}

0 comments on commit b8ff4f0

Please sign in to comment.