Skip to content

Commit

Permalink
Publish on release
Browse files Browse the repository at this point in the history
  • Loading branch information
outscale-mdr committed Feb 6, 2023
1 parent 0b2caf5 commit ee9235a
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/scripts/create-m2-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

if [ -z "${SONATYPE_USERNAME}" ]; then
echo "Set SONATYPE_USERNAME to continue";
exit 1
fi

if [ -z "${SONATYPE_PASSWORD}" ]; then
echo "Set SONATYPE_PASSWORD to continue";
exit 1
fi

root=$(cd "$(dirname "$0")/../.." && pwd)

mkdir -p "${root}/.m2"
cat <<EOF > "${root}/.m2/settings.xml"
<settings>
<servers>
<server>
<id>ossrh</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>
EOF

exit 0
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: osc-sdk-java maven publishing
on:
release:
types: [released]

jobs:
publish:
environment: publish
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Setup credentials
run: .github/scripts/create-m2-settings.xml
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
- name: Publish
run: mvn deploy

0 comments on commit ee9235a

Please sign in to comment.