Skip to content

Commit ee9235a

Browse files
committed
Publish on release
1 parent 0b2caf5 commit ee9235a

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
if [ -z "${SONATYPE_USERNAME}" ]; then
4+
echo "Set SONATYPE_USERNAME to continue";
5+
exit 1
6+
fi
7+
8+
if [ -z "${SONATYPE_PASSWORD}" ]; then
9+
echo "Set SONATYPE_PASSWORD to continue";
10+
exit 1
11+
fi
12+
13+
root=$(cd "$(dirname "$0")/../.." && pwd)
14+
15+
mkdir -p "${root}/.m2"
16+
cat <<EOF > "${root}/.m2/settings.xml"
17+
<settings>
18+
<servers>
19+
<server>
20+
<id>ossrh</id>
21+
<username>${SONATYPE_USERNAME}</username>
22+
<password>${SONATYPE_PASSWORD}</password>
23+
</server>
24+
</servers>
25+
</settings>
26+
EOF
27+
28+
exit 0

.github/workflows/publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: osc-sdk-java maven publishing
2+
on:
3+
release:
4+
types: [released]
5+
6+
jobs:
7+
publish:
8+
environment: publish
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-java@v3
13+
with:
14+
distribution: 'temurin'
15+
java-version: '11'
16+
cache: 'maven'
17+
- name: Setup credentials
18+
run: .github/scripts/create-m2-settings.xml
19+
env:
20+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
21+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
22+
- name: Publish
23+
run: mvn deploy
24+

0 commit comments

Comments
 (0)