|
1 | 1 | name: Quarkiverse Release
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - pull_request: |
5 |
| - types: [closed] |
6 |
| - paths: |
7 |
| - - '.github/project.yml' |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + releaseVersion: |
| 7 | + description: "Version to use when preparing a release. Use `auto` to use the latest version from the pom.xml." |
| 8 | + required: true |
| 9 | + default: "auto" |
| 10 | + sourceBranch: |
| 11 | + description: "Which branch contains the previous release version." |
| 12 | + default: "main" |
8 | 13 |
|
9 | 14 | concurrency:
|
10 |
| - group: ${{ github.workflow }}-${{ github.ref }} |
11 |
| - cancel-in-progress: true |
| 15 | + group: "quarkiverse-release" |
| 16 | + cancel-in-progress: false |
12 | 17 |
|
13 | 18 | defaults:
|
14 | 19 | run:
|
15 | 20 | shell: bash
|
| 21 | +permissions: |
| 22 | + contents: write |
| 23 | + packages: write |
| 24 | + checks: write |
| 25 | + |
16 | 26 |
|
17 | 27 | jobs:
|
18 | 28 | release:
|
19 | 29 | runs-on: ubuntu-latest
|
20 | 30 | name: release
|
21 |
| - if: ${{github.event.pull_request.merged == true}} |
22 |
| - |
23 | 31 | steps:
|
24 |
| - - uses: radcortez/project-metadata-action@main |
25 |
| - name: Retrieve project metadata |
26 |
| - id: metadata |
| 32 | + - uses: actions/checkout@v4 |
27 | 33 | with:
|
28 |
| - github-token: ${{secrets.GITHUB_TOKEN}} |
29 |
| - metadata-file-path: '.github/project.yml' |
30 |
| - |
31 |
| - - uses: actions/checkout@v3 |
| 34 | + ref: ${{ github.event.inputs.sourceBranch }} |
32 | 35 |
|
33 | 36 | - name: Import GPG key
|
34 |
| - id: import_gpg |
35 |
| - uses: crazy-max/ghaction-import-gpg@v6 |
| 37 | + uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 #v6.1.0 |
36 | 38 | with:
|
37 | 39 | gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
38 |
| - passphrase: ${{ secrets.GPG_PASSPHRASE }} |
39 |
| - |
| 40 | + passphrase: ${{ secrets.GPG_SECRET }} |
| 41 | + |
40 | 42 | - name: Set up JDK 11
|
41 | 43 | uses: actions/setup-java@v3
|
42 | 44 | with:
|
43 | 45 | distribution: temurin
|
44 | 46 | java-version: 11
|
45 | 47 | cache: 'maven'
|
46 |
| - server-id: ossrh |
47 |
| - server-username: MAVEN_USERNAME |
48 |
| - server-password: MAVEN_PASSWORD |
| 48 | + server-id: github |
| 49 | + gpg-passphrase: GPG_PASSPHRASE |
| 50 | + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} |
49 | 51 |
|
50 |
| - - name: Configure Git author |
| 52 | + - name: Find version to use |
| 53 | + id: version |
51 | 54 | run: |
|
52 |
| - git config --local user.email "[email protected]" |
53 |
| - git config --local user.name "GitHub Action" |
| 55 | + if [[ "${{ github.event.inputs.releaseVersion }}" -eq "auto" ]]; then |
| 56 | + echo "No release version provided, using the latest version from the pom.xml" |
| 57 | + new_version=`mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout | sed -e 's/-SNAPSHOT$//'` |
| 58 | + echo "New version will be $new_version" |
| 59 | + echo version=$new_version >> $GITHUB_OUTPUT |
| 60 | + else |
| 61 | + echo version=${{ github.event.inputs.releaseVersion }} >> $GITHUB_OUTPUT |
| 62 | + fi |
| 63 | + |
| 64 | + - name: Pre-Release Check - Version |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + run: | |
| 68 | + gh api --method GET /repos/${{github.repository}}/releases -f sort=updated -f direction=asc > releases.json |
| 69 | + release_version_exists=$(jq -r --arg RELEASE_VERSION ${{ steps.version.outputs.version }} '.[].name|select(.|test($RELEASE_VERSION))' releases.json) |
| 70 | + if [[ ! -z "$release_version_exists" ]]; then |
| 71 | + echo "Version ${{ steps.version.outputs.version }} has been previously released. Please change release version." |
| 72 | + exit 1 |
| 73 | + else |
| 74 | + echo "New version: ${{ steps.version.outputs.version }} going to be released!" |
| 75 | + fi |
| 76 | + |
| 77 | + - name: Release Version - Prepare |
| 78 | + run: >- |
| 79 | + mvn -B -U versions:set |
| 80 | + -DnewVersion=${{ steps.version.outputs.version }} |
| 81 | + -DprocessAllModules |
| 82 | + -DgenerateBackupPoms=false |
| 83 | +
|
54 | 84 |
|
55 | 85 | - name: Update latest release version in docs
|
56 | 86 | run: |
|
57 | 87 | mvn -B -ntp -pl docs -am generate-resources -Denforcer.skip -Dformatter.skip -Dimpsort.skip
|
58 | 88 | if ! git diff --quiet docs/modules/ROOT/pages/includes/attributes.adoc; then
|
59 | 89 | git add docs/modules/ROOT/pages/includes/attributes.adoc
|
60 |
| - git commit -m "Update the latest release version ${{steps.metadata.outputs.current-version}} in documentation" |
61 | 90 | fi
|
| 91 | + |
| 92 | + - name: Verify Maven |
| 93 | + run: mvn verify |
| 94 | + |
| 95 | + - name: Publishing Test Results - Unit/Integration Tests Pre-Condition |
| 96 | + if: always() |
| 97 | + id: unit_integration_test_report_exists |
| 98 | + uses: andstor/file-existence-action@v2 |
| 99 | + with: |
| 100 | + files: "**/surefire-reports/**/TEST*.xml" |
| 101 | + |
| 102 | + - name: Publishing Test Results - Unit/Integration Tests |
| 103 | + |
| 104 | + if: always() && steps.unit_integration_test_report_exists.outputs.files_exists == 'true' |
| 105 | + with: |
| 106 | + name: Test Results |
| 107 | + path: "**/surefire-reports/**/TEST*.xml" |
| 108 | + fail-on-error: 'false' |
| 109 | + reporter: java-junit |
| 110 | + only-summary: 'true' |
| 111 | + |
| 112 | + - name: Configure Git author |
| 113 | + run: | |
| 114 | + git config --local user.email "[email protected]" |
| 115 | + git config --local user.name "GitHub Action" |
62 | 116 |
|
63 |
| - - name: Maven release ${{steps.metadata.outputs.current-version}} |
| 117 | + - name: Release Version - Checkin |
| 118 | + run: >- |
| 119 | + mvn validate |
| 120 | + scm:checkin |
| 121 | + -DscmVersion=${{ github.event.inputs.sourceBranch }} |
| 122 | + -DscmVersionType=branch |
| 123 | + -Dmessage="[ci skip] prepare release ${{ steps.version.outputs.version }}" && |
| 124 | + mvn scm:tag -Dtag=${{ steps.version.outputs.version }} |
| 125 | +
|
| 126 | +
|
| 127 | + - name: GitHub Packages - Deploy Artifacts |
| 128 | + env: |
| 129 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 130 | + GPG_PASSPHRASE: ${{ secrets.GPG_SECRET }} |
64 | 131 | run: |
|
65 |
| - mvn -B release:prepare -Prelease -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} |
66 |
| - mvn -B release:perform -Darguments=-DperformRelease -DperformRelease -Prelease |
| 132 | + mvn deploy -Dmaven.install.skip=true -Pgithub,publish |
| 133 | + |
| 134 | + - name: maven-settings-xml-action |
| 135 | + uses: whelk-io/maven-settings-xml-action@v4 |
| 136 | + with: |
| 137 | + servers: '[{ "id": "ossrh", "username": "${{ secrets.OSSRH_USER }}", "password": "${{ secrets.OSSRH_PASS }}" }]' |
| 138 | + |
| 139 | + - name: Maven Central - Deploy Artifacts |
67 | 140 | env:
|
68 |
| - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} |
69 |
| - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |
70 |
| - |
71 |
| - - name: Push changes to ${{github.base_ref}} branch |
| 141 | + GPG_PASSPHRASE: ${{ secrets.GPG_SECRET }} |
72 | 142 | run: |
|
73 |
| - git push |
74 |
| - git push origin ${{steps.metadata.outputs.current-version}} |
| 143 | + mvn deploy -Dmaven.install.skip=true -Possrh,publish |
| 144 | +
|
| 145 | + - name: Create GitHub Release |
| 146 | + uses: ncipollo/release-action@v1 |
| 147 | + with: |
| 148 | + tag: "${{ steps.version.outputs.version }}" |
| 149 | + generateReleaseNotes: true |
| 150 | + makeLatest: true |
| 151 | + |
| 152 | + - name: Next Develoment Version - Prepare and Checkin |
| 153 | + run: >- |
| 154 | + mvn -B -U build-helper:parse-version versions:set |
| 155 | + -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT |
| 156 | + -DprocessAllModules |
| 157 | + -DgenerateBackupPoms=false && |
| 158 | + mvn validate scm:checkin |
| 159 | + -DscmVersion=${{ github.event.inputs.sourceBranch }} |
| 160 | + -DscmVersionType=branch |
| 161 | + -Dmessage="[ci skip] prepare for next development iteration" |
| 162 | +
|
| 163 | +
|
0 commit comments