|
1 | | -name: "Release" |
| 1 | +name: Release |
2 | 2 | on: |
3 | 3 | release: |
4 | 4 | types: [published] |
| 5 | +env: |
| 6 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 7 | + JAVA_VERSION: '17.0.15' # this must be a specific version for reproducible builds |
| 8 | + RELEASE_TAG_PREFIX: 'v' |
5 | 9 | jobs: |
6 | | - release: |
7 | | - name: "Publish Release" |
8 | | - runs-on: ubuntu-24.04 |
| 10 | + publish: |
9 | 11 | permissions: |
10 | | - packages: read # for pre-release workflow |
11 | | - contents: write # to commit changes related to the release and publish documentation to gh-pages |
12 | | - issues: write # to modify milestones |
| 12 | + packages: read # pre-release workflow |
| 13 | + contents: write # to create release |
| 14 | + issues: write # to modify milestones |
| 15 | + runs-on: ubuntu-latest |
| 16 | + outputs: |
| 17 | + release_version: ${{ steps.release_version.outputs.value }} |
| 18 | + extract_repository_name: ${{ steps.extract_repository_name.outputs.repository_name }} |
13 | 19 | steps: |
14 | | - - name: "📥 Checkout repository" |
| 20 | + - name: "📝 Store the current release version" |
| 21 | + id: release_version |
| 22 | + run: | |
| 23 | + export RELEASE_VERSION="${{ github.ref_name }}" |
| 24 | + export RELEASE_VERSION=${RELEASE_VERSION:${#RELEASE_TAG_PREFIX}} |
| 25 | + echo "Found Release Version: ${RELEASE_VERSION}" |
| 26 | + echo "value=${RELEASE_VERSION}" >> $GITHUB_OUTPUT |
| 27 | + - name: "Extract repository name" |
| 28 | + id: extract_repository_name |
| 29 | + run: | |
| 30 | + echo "repository_name=${GITHUB_REPOSITORY##*/}" >> $GITHUB_OUTPUT |
| 31 | + - name: "📥 Checkout the repository" |
15 | 32 | uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + ref: v${{ steps.release_version.outputs.value }} |
| 36 | + - name: 'Ensure Common Build Date' # to ensure a reproducible build |
| 37 | + run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "$GITHUB_ENV" |
| 38 | + - name: "Ensure source files use common date" |
| 39 | + run: | |
| 40 | + find . -depth \( -type f -o -type d \) -exec touch -d "@${SOURCE_DATE_EPOCH}" {} + |
16 | 41 | - name: "☕️ Setup JDK" |
17 | 42 | uses: actions/setup-java@v4 |
18 | 43 | with: |
19 | | - java-version: 17 |
20 | 44 | distribution: liberica |
| 45 | + java-version: ${{ env.JAVA_VERSION }} |
21 | 46 | - name: "🐘 Setup Gradle" |
22 | 47 | uses: gradle/actions/setup-gradle@v4 |
23 | | - with: |
24 | | - develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} |
25 | | - - name: "📝 Store the current release version" |
26 | | - run: | |
27 | | - echo "Release version: ${GITHUB_REF:11}" |
28 | | - echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV |
29 | | - - name: "⚙ Run pre-release" |
30 | | - uses: apache/grails-github-actions/pre-release@asf |
| 48 | + - name: "⚙️ Run pre-release" |
| 49 | + uses: grails/github-actions/pre-release@asf |
| 50 | + env: |
| 51 | + RELEASE_VERSION: ${{ steps.release_version.outputs.value }} |
| 52 | + - name: "🧩 Run Assemble" |
| 53 | + id: assemble |
| 54 | + run: ./gradlew -U assemble |
31 | 55 | - name: "🔐 Generate key file for artifact signing" |
32 | 56 | env: |
33 | 57 | SECRING_FILE: ${{ secrets.SECRING_FILE }} |
34 | 58 | run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg |
35 | | - - name: "📤 Publish artifacts to Sonatype" |
| 59 | + - name: "📤 Publish to Maven Central" |
36 | 60 | env: |
37 | 61 | GRAILS_PUBLISH_RELEASE: 'true' |
38 | 62 | NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} |
39 | 63 | NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} |
40 | | - NEXUS_PUBLISH_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }} |
41 | | - NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }} |
| 64 | + NEXUS_PUBLISH_URL: 'https://ossrh-staging-api.central.sonatype.com/service/local/' |
| 65 | + NEXUS_PUBLISH_DESCRIPTION: '${{ steps.extract_repository_name.outputs.repository_name }}:${{ steps.release_version.outputs.value }}' |
42 | 66 | SIGNING_KEY: ${{ secrets.SIGNING_KEY }} |
43 | 67 | SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} |
44 | 68 | run: > |
45 | 69 | ./gradlew |
46 | 70 | -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg |
47 | | - publishToSonatype |
48 | | - closeAndReleaseSonatypeStagingRepository |
| 71 | + publishMavenPublicationToSonatypeRepository |
| 72 | + closeSonatypeStagingRepository |
| 73 | + - name: "Generate Build Date file" |
| 74 | + run: echo "$SOURCE_DATE_EPOCH" >> build/BUILD_DATE.txt |
| 75 | + - name: "Upload Build Date file" |
| 76 | + uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 |
| 77 | + with: |
| 78 | + files: build/BUILD_DATE.txt |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + release: |
| 82 | + needs: publish |
| 83 | + runs-on: ubuntu-latest |
| 84 | + env: release |
| 85 | + permissions: |
| 86 | + contents: write |
| 87 | + issues: write |
| 88 | + pull-requests: write |
| 89 | + steps: |
| 90 | + - name: "📥 Checkout repository" |
| 91 | + uses: actions/checkout@v4 |
| 92 | + with: |
| 93 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 94 | + ref: v${{ needs.publish.outputs.release_version }} |
| 95 | + - name: "☕️ Setup JDK" |
| 96 | + uses: actions/setup-java@v4 |
| 97 | + with: |
| 98 | + distribution: liberica |
| 99 | + java-version: ${{ env.JAVA_VERSION }} |
| 100 | + - name: "🐘 Setup Gradle" |
| 101 | + uses: gradle/actions/setup-gradle@v4 |
| 102 | + - name: "📤 Release staging repository" |
| 103 | + env: |
| 104 | + GRAILS_PUBLISH_RELEASE: 'true' |
| 105 | + NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} |
| 106 | + NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} |
| 107 | + NEXUS_PUBLISH_URL: 'https://ossrh-staging-api.central.sonatype.com/service/local/' |
| 108 | + NEXUS_PUBLISH_DESCRIPTION: '${{ needs.publish.outputs.extract_repository_name }}:${{ needs.publish.outputs.release_version }}' |
| 109 | + run: > |
| 110 | + ./gradlew |
| 111 | + findSonatypeStagingRepository |
| 112 | + releaseSonatypeStagingRepository |
49 | 113 | - name: "📖 Generate Documentation" |
50 | 114 | run: ./gradlew docs |
51 | 115 | - name: "📤 Publish Documentation to Github Pages" |
|
54 | 118 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
55 | 119 | GRADLE_PUBLISH_RELEASE: 'true' |
56 | 120 | SOURCE_FOLDER: build/docs |
57 | | - VERSION: ${{ env.RELEASE_VERSION }} |
| 121 | + VERSION: ${{ needs.publish.outputs.release_version }} |
58 | 122 | - name: "⚙️ Run post-release" |
59 | 123 | uses: apache/grails-github-actions/post-release@asf |
0 commit comments