microsoft/gctoolkit
Publicmirrored fromhttps://github.com/microsoft/gctoolkitAvailable
.github/workflows/jreleaser.yml
53lines · modecode
| 1 | name: Release to GitHub using JReleaser |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | |
| 6 | jobs: |
| 7 | publish: |
| 8 | |
| 9 | runs-on: ubuntu-latest |
| 10 | |
| 11 | steps: |
| 12 | - name: Checkout project |
| 13 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 14 | with: |
| 15 | ref: main |
| 16 | fetch-depth: 0 |
| 17 | |
| 18 | - name: Cache Maven |
| 19 | uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1 |
| 20 | with: |
| 21 | path: ~/.m2/repository |
| 22 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
| 23 | restore-keys: ${{ runner.os }}-m2 |
| 24 | |
| 25 | - name: Setup Java JDK |
| 26 | uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 |
| 27 | with: |
| 28 | java-version: '11' |
| 29 | distribution: 'microsoft' |
| 30 | server-id: ossrh |
| 31 | server-username: MAVEN_USERNAME |
| 32 | server-password: MAVEN_CENTRAL_TOKEN |
| 33 | |
| 34 | - name: Configure Git user |
| 35 | run: | |
| 36 | git config user.email "noreply@github.com" |
| 37 | git config user.name "GitHub" |
| 38 | git config committer.name "GitHub" |
| 39 | git config committer.email "noreply@github.com" |
| 40 | |
| 41 | - name: Version |
| 42 | id: version |
| 43 | run: | |
| 44 | release_version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) |
| 45 | release_version=${release_version%-*} |
| 46 | echo ::set-output name=version::${release_version} |
| 47 | |
| 48 | - name: Git-release |
| 49 | run: | |
| 50 | ./mvnw -B versions:set -DnewVersion=${{steps.version.outputs.version}} |
| 51 | ./mvnw -B -pl :gctoolkit -Pjreleaser jreleaser:release |
| 52 | env: |
| 53 | JRELEASER_GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
| 54 | |