|
| 1 | +name: Grace Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v* |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + create_draft_release: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + env: |
| 15 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 16 | + steps: |
| 17 | + - name: Create draft release |
| 18 | + run: | |
| 19 | + gh release create \ |
| 20 | + --repo ${{ github.repository }} \ |
| 21 | + --title ${{ github.ref_name }} \ |
| 22 | + --notes '' \ |
| 23 | + --draft \ |
| 24 | + ${{ github.ref_name }} |
| 25 | + release_and_publish: |
| 26 | + needs: create_draft_release |
| 27 | + runs-on: ubuntu-latest |
| 28 | + strategy: |
| 29 | + matrix: |
| 30 | + java: ['17'] |
| 31 | + env: |
| 32 | + GIT_USER_NAME: rainboyan |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout repository |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + - uses: gradle/actions/wrapper-validation@v3 |
| 40 | + - name: Set up JDK |
| 41 | + uses: actions/setup-java@v4 |
| 42 | + with: |
| 43 | + distribution: 'adopt' |
| 44 | + java-version: ${{ matrix.java }} |
| 45 | + - name: Extract Target Branch |
| 46 | + id: extract_branch |
| 47 | + run: | |
| 48 | + echo "Determining Target Branch" |
| 49 | + TARGET_BRANCH=`cat $GITHUB_EVENT_PATH | jq '.release.target_commitish' | sed -e 's/^"\(.*\)"$/\1/g'` |
| 50 | + echo $TARGET_BRANCH |
| 51 | + echo ::set-output name=value::${TARGET_BRANCH} |
| 52 | + - name: Set the current release version |
| 53 | + id: release_version |
| 54 | + run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT |
| 55 | + - name: Generate secring file |
| 56 | + id: secring |
| 57 | + env: |
| 58 | + SECRING_FILE: ${{ secrets.SECRING_FILE }} |
| 59 | + run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg |
| 60 | + - name: Publish to Sonatype OSSRH |
| 61 | + id: publish |
| 62 | + if: steps.secring.outcome == 'success' |
| 63 | + uses: gradle/actions/setup-gradle@v3 |
| 64 | + env: |
| 65 | + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} |
| 66 | + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} |
| 67 | + SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }} |
| 68 | + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} |
| 69 | + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} |
| 70 | + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} |
| 71 | + SECRING_FILE: ${{ secrets.SECRING_FILE }} |
| 72 | + with: |
| 73 | + arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg :plugin:publishToSonatype closeAndReleaseSonatypeStagingRepository |
0 commit comments