|
5 | 5 | workflow_dispatch: |
6 | 6 | inputs: |
7 | 7 | release_version: |
8 | | - description: 'Version to release (if empty, derive from project version)' |
| 8 | + description: "Version to release (if empty, derive from project version)" |
9 | 9 | required: false |
10 | 10 | # Automatic trigger on pushing a version tag (e.g., "v1.2.3") |
11 | 11 | push: |
12 | 12 | tags: |
13 | | - - 'v*' |
| 13 | + - "v*" |
14 | 14 | # For testing: |
15 | | - pull_request: |
16 | | - branches: |
17 | | - - master |
| 15 | + # pull_request: |
| 16 | + # branches: |
| 17 | + # - master |
18 | 18 |
|
19 | | -jobs: |
| 19 | +jobs: |
| 20 | + # tests and tests-no-docker are from tests.yml and build the actual native libraries that will be used in the release. |
20 | 21 | tests: |
21 | 22 | name: Java ${{ matrix.java-version }} ${{ matrix.os }} ${{ matrix.dockcross-only }} |
22 | 23 | runs-on: ${{ matrix.os }} |
|
26 | 27 | os: [ubuntu-latest] |
27 | 28 | java-distribution: [adopt] |
28 | 29 | java-version: [8] |
29 | | - dockcross-only: ["android-arm", "android-arm64", "linux-arm64", "linux-armv5", "linux-armv7", "linux-s390x", "linux-ppc64le", "linux-x64", "linux-x86", "windows-static-x64", "windows-static-x86"] |
| 30 | + dockcross-only: |
| 31 | + [ |
| 32 | + "android-arm", |
| 33 | + "android-arm64", |
| 34 | + "linux-arm64", |
| 35 | + "linux-armv5", |
| 36 | + "linux-armv7", |
| 37 | + "linux-s390x", |
| 38 | + "linux-ppc64le", |
| 39 | + "linux-x64", |
| 40 | + "linux-x86", |
| 41 | + "windows-static-x64", |
| 42 | + "windows-static-x86", |
| 43 | + ] |
30 | 44 |
|
31 | 45 | steps: |
32 | 46 | - uses: actions/checkout@v4 |
@@ -72,15 +86,14 @@ jobs: |
72 | 86 | path: | |
73 | 87 | src/main/resources/*/*.so |
74 | 88 | src/main/resources/*/*.dll |
75 | | - if-no-files-found: error |
| 89 | + if-no-files-found: error |
76 | 90 |
|
77 | 91 | tests-no-docker: |
78 | 92 | name: Java (No Docker) ${{ matrix.java-version }} ${{ matrix.os }} |
79 | 93 | runs-on: ${{ matrix.os }} |
80 | 94 |
|
81 | 95 | strategy: |
82 | 96 | matrix: |
83 | | - # TODO: Docker on macos-latest running is not working |
84 | 97 | os: [macos-latest] |
85 | 98 | java-distribution: [adopt] |
86 | 99 | java-version: [8] |
@@ -118,106 +131,106 @@ jobs: |
118 | 131 | with: |
119 | 132 | name: macos-built-shared-objects |
120 | 133 | path: src/main/resources/*/*.dylib |
121 | | - if-no-files-found: error |
| 134 | + if-no-files-found: error |
122 | 135 |
|
123 | 136 | release: |
124 | | - runs-on: ubuntu-latest |
125 | | - permissions: |
126 | | - contents: write # allow pushing commits/tags |
127 | | - |
128 | | - needs: |
129 | | - - tests |
130 | | - - tests-no-docker |
131 | | - |
132 | | - steps: |
133 | | - - name: Check out code |
134 | | - uses: actions/checkout@v3 |
135 | | - |
136 | | - - name: Set up JDK |
137 | | - uses: actions/setup-java@v3 |
138 | | - with: |
139 | | - distribution: 'temurin' |
140 | | - java-version: '21' |
141 | | - |
142 | | - - name: Determine release version |
143 | | - id: vars |
144 | | - run: | |
145 | | - # Derive the release version (drop "-SNAPSHOT") from Gradle project or input |
146 | | - VERSION_INPUT="${{ github.event.inputs.release_version || '' }}" |
147 | | - if [ -n "$VERSION_INPUT" ]; then |
148 | | - RELEASE_VERSION="$VERSION_INPUT" |
149 | | - else |
150 | | - # Read version from build.gradle.kts or gradle.properties |
151 | | - RELEASE_VERSION=$(grep -E 'version\s*=' build.gradle.kts | sed -E 's/.*\"(.+)-SNAPSHOT\".*/\1/') |
152 | | - fi |
153 | | - echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV |
154 | | -
|
155 | | - - name: Remove -SNAPSHOT suffix (prepare release version) |
156 | | - if: ${{ github.event_name == 'workflow_dispatch' }} |
157 | | - run: | |
158 | | - sed -i -E "s/${RELEASE_VERSION}-SNAPSHOT/$RELEASE_VERSION/" build.gradle.kts gradle.properties || true |
159 | | - git config user.name "github-actions" |
160 | | - git config user.email "[email protected]" |
161 | | - git commit -am "chore: release $RELEASE_VERSION [skip ci]" |
162 | | -
|
163 | | - - name: Create Git tag for release |
164 | | - if: ${{ github.event_name == 'workflow_dispatch' }} |
165 | | - run: | |
166 | | - git tag -a "v${RELEASE_VERSION}" -m "Release $RELEASE_VERSION" |
167 | | - git push origin HEAD:main --follow-tags |
168 | | -
|
169 | | - - name: Download Docker binaries |
170 | | - |
171 | | - with: |
172 | | - pattern: docker-built-shared-objects-* |
173 | | - merge-multiple: true |
174 | | - path: src/main/resources/ |
175 | | - |
176 | | - - name: Download Mac binaries |
177 | | - |
178 | | - with: |
179 | | - name: macos-built-shared-objects |
180 | | - path: src/main/resources/ |
181 | | - |
182 | | - - name: Download and test |
183 | | - run: | |
184 | | - ./gradlew clean test assemble -Ph3GithubArtifactsUse=true -Ph3GithubArtifactsByRun=true |
185 | | -
|
186 | | - - name: WIP test |
187 | | - run: | |
188 | | - ls -lh build/libs |
189 | | - for f in build/libs/*.jar; do |
190 | | - echo "File: $f" |
191 | | - unzip -l "$f" |
192 | | - done |
193 | | -
|
194 | | - # - name: Publish to Sonatype OSSRH (Maven Central) |
195 | | - # env: |
196 | | - # ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} |
197 | | - # ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} |
198 | | - # ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} |
199 | | - # OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} |
200 | | - # OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} |
201 | | - # OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }} |
202 | | - # run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository |
203 | | - |
204 | | - # - name: Create GitHub Release (with changelog notes) |
205 | | - # # This uses an action to create a release on GitHub |
206 | | - # uses: softprops/action-gh-release@v1 |
207 | | - # with: |
208 | | - # tag_name: "v${{ env.RELEASE_VERSION }}" |
209 | | - # release_name: "${{ env.RELEASE_VERSION }}" |
210 | | - # body_path: CHANGELOG.md # assumes changelog contains latest release notes at top |
211 | | - # env: |
212 | | - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
213 | | - |
214 | | - # - name: Bump to next snapshot version |
215 | | - # run: | |
216 | | - # # Bump minor version (for example) and append -SNAPSHOT for continued development |
217 | | - # NEXT_VERSION=$(echo $RELEASE_VERSION | awk -F. '{$NF += 1; OFS="."; print $0}') # increment last segment |
218 | | - # NEXT_VERSION="$NEXT_VERSION-SNAPSHOT" |
219 | | - # sed -i -E "s/$RELEASE_VERSION/$NEXT_VERSION/" build.gradle.kts gradle.properties || true |
220 | | - # git config user.name "github-actions" |
221 | | - # git config user.email "[email protected]" |
222 | | - # git commit -am "chore: start next development cycle $NEXT_VERSION [skip ci]" |
223 | | - # git push origin HEAD:main |
| 137 | + runs-on: ubuntu-latest |
| 138 | + permissions: |
| 139 | + contents: write # allow pushing commits/tags |
| 140 | + |
| 141 | + needs: |
| 142 | + - tests |
| 143 | + - tests-no-docker |
| 144 | + |
| 145 | + steps: |
| 146 | + - name: Check out code |
| 147 | + uses: actions/checkout@v3 |
| 148 | + |
| 149 | + - name: Set up JDK |
| 150 | + uses: actions/setup-java@v3 |
| 151 | + with: |
| 152 | + distribution: "temurin" |
| 153 | + java-version: "21" |
| 154 | + |
| 155 | + - name: Determine release version |
| 156 | + id: vars |
| 157 | + run: | |
| 158 | + # Derive the release version (drop "-SNAPSHOT") from Gradle project or input |
| 159 | + VERSION_INPUT="${{ github.event.inputs.release_version || '' }}" |
| 160 | + if [ -n "$VERSION_INPUT" ]; then |
| 161 | + RELEASE_VERSION="$VERSION_INPUT" |
| 162 | + else |
| 163 | + # Read version from build.gradle.kts or gradle.properties |
| 164 | + RELEASE_VERSION=$(grep -E 'version\s*=' build.gradle.kts | sed -E 's/.*\"(.+)-SNAPSHOT\".*/\1/') |
| 165 | + fi |
| 166 | + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV |
| 167 | +
|
| 168 | + - name: Remove -SNAPSHOT suffix (prepare release version) |
| 169 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 170 | + run: | |
| 171 | + sed -i -E "s/${RELEASE_VERSION}-SNAPSHOT/$RELEASE_VERSION/" build.gradle.kts gradle.properties || true |
| 172 | + git config user.name "github-actions" |
| 173 | + git config user.email "[email protected]" |
| 174 | + git commit -am "chore: release $RELEASE_VERSION [skip ci]" |
| 175 | +
|
| 176 | + - name: Create Git tag for release |
| 177 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 178 | + run: | |
| 179 | + git tag -a "v${RELEASE_VERSION}" -m "Release $RELEASE_VERSION" |
| 180 | + git push origin HEAD:main --follow-tags |
| 181 | +
|
| 182 | + - name: Download Docker binaries |
| 183 | + |
| 184 | + with: |
| 185 | + pattern: docker-built-shared-objects-* |
| 186 | + merge-multiple: true |
| 187 | + path: src/main/resources/ |
| 188 | + |
| 189 | + - name: Download Mac binaries |
| 190 | + |
| 191 | + with: |
| 192 | + name: macos-built-shared-objects |
| 193 | + path: src/main/resources/ |
| 194 | + |
| 195 | + - name: Download and test |
| 196 | + run: | |
| 197 | + ./gradlew clean test assemble -Ph3GithubArtifactsUse=true -Ph3GithubArtifactsByRun=true |
| 198 | +
|
| 199 | + - name: List files in jars |
| 200 | + run: | |
| 201 | + ls -lh build/libs |
| 202 | + for f in build/libs/*.jar; do |
| 203 | + echo "File: $f" |
| 204 | + unzip -l "$f" |
| 205 | + done |
| 206 | +
|
| 207 | + - name: Publish to Sonatype OSSRH (Maven Central) |
| 208 | + env: |
| 209 | + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} |
| 210 | + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} |
| 211 | + ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} |
| 212 | + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} |
| 213 | + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} |
| 214 | + OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }} |
| 215 | + run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository |
| 216 | + |
| 217 | + - name: Create GitHub Release (with changelog notes) |
| 218 | + # This uses an action to create a release on GitHub |
| 219 | + uses: softprops/action-gh-release@v1 |
| 220 | + with: |
| 221 | + tag_name: "v${{ env.RELEASE_VERSION }}" |
| 222 | + release_name: "${{ env.RELEASE_VERSION }}" |
| 223 | + body_path: CHANGELOG.md # assumes changelog contains latest release notes at top |
| 224 | + env: |
| 225 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 226 | + |
| 227 | + - name: Bump to next snapshot version |
| 228 | + run: | |
| 229 | + # Bump minor version (for example) and append -SNAPSHOT for continued development |
| 230 | + NEXT_VERSION=$(echo $RELEASE_VERSION | awk -F. '{$NF += 1; OFS="."; print $0}') # increment last segment |
| 231 | + NEXT_VERSION="$NEXT_VERSION-SNAPSHOT" |
| 232 | + sed -i -E "s/$RELEASE_VERSION/$NEXT_VERSION/" build.gradle.kts gradle.properties || true |
| 233 | + git config user.name "github-actions" |
| 234 | + git config user.email "[email protected]" |
| 235 | + git commit -am "chore: start next development cycle $NEXT_VERSION [skip ci]" |
| 236 | + git push origin HEAD:main |
0 commit comments