-
Notifications
You must be signed in to change notification settings - Fork 6
38 lines (38 loc) · 1.26 KB
/
publish-snapshot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Publish package to GitHub Packages
on:
push:
paths-ignore:
- 'README.md'
branches-ignore:
- 'dependabot/**'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v3
- name: Get current version
id: current-version
# $VERSION should contain something like "Project version: 0.4.1-SNAPSHOT"
run: |
VERSION=$(./gradlew currentVersion -q | grep "Project version")
echo "currentVersionInfo=$VERSION" >> "$GITHUB_OUTPUT"
- name: Publish package to Sonatype
if: ${{ contains(steps.current-version.outputs.currentVersionInfo, 'SNAPSHOT') }}
uses: gradle/gradle-build-action@v3
with:
arguments: :tests-execution-chart-commons:publishToSonatype -i
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}