microsoft/gctoolkit
Publicmirrored fromhttps://github.com/microsoft/gctoolkitAvailable
.github/workflows/publish.yml
49lines · modecode
| 1 | name: Publish to Maven Central |
| 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@v2 |
| 14 | with: |
| 15 | ref: main |
| 16 | |
| 17 | - name: Cache Maven |
| 18 | uses: actions/cache@v2.1.4 |
| 19 | with: |
| 20 | path: ~/.m2/repository |
| 21 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
| 22 | restore-keys: ${{ runner.os }}-m2 |
| 23 | |
| 24 | - name: Setup Java JDK |
| 25 | uses: actions/setup-java@v2 |
| 26 | with: |
| 27 | java-version: '11' |
| 28 | distribution: 'adopt' |
| 29 | server-id: ossrh |
| 30 | server-username: MAVEN_USERNAME |
| 31 | server-password: MAVEN_CENTRAL_TOKEN |
| 32 | gpg-private-key: ${{ secrets.GPG_PRIVATEKEY }} |
| 33 | gpg-passphrase: MAVEN_GPG_PASSPHRASE |
| 34 | |
| 35 | - name: Configure Git user |
| 36 | run: | |
| 37 | git config user.email "actions@github.com" |
| 38 | git config user.name "GitHub Actions" |
| 39 | |
| 40 | - name: Release |
| 41 | run: | |
| 42 | export GPG_TTY=$(tty) |
| 43 | ./mvnw -Darguments="-Drelease=true" -B release:prepare release:perform -Drelease=true \ |
| 44 | -Drepository.url=https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git |
| 45 | |
| 46 | env: |
| 47 | MAVEN_USERNAME: ${{ secrets.SONATYPE_NAME }} |
| 48 | MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} |
| 49 | MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |