Skip to content

Commit c286124

Browse files
committed
fix: enable github workflows
Signed-off-by: Phil Adams <phil_adams@us.ibm.com>
1 parent 1a51aad commit c286124

File tree

4 files changed

+162
-2
lines changed

4 files changed

+162
-2
lines changed

.github/workflows/build.yaml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# This workflow will build and unit test the project.
2+
# If the workflow is running on the "main" branch, then
3+
# semantic-release is also run to create a new release (if
4+
# warranted by the new commits being built).
5+
6+
name: Build/Test
7+
8+
on:
9+
push:
10+
branches: [ '**' ]
11+
pull_request:
12+
branches: [ '**' ]
13+
workflow_dispatch:
14+
# Allow workflow to be triggered manually.
15+
16+
jobs:
17+
detect-secrets:
18+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
19+
name: Detect-Secrets
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: 3.12
30+
31+
- name: Install detect-secrets
32+
run: |
33+
pip install --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets"
34+
35+
- name: Run detect-secrets
36+
run: |
37+
detect-secrets scan --update .secrets.baseline
38+
detect-secrets -v audit --report --fail-on-unaudited --fail-on-live --fail-on-audited-real .secrets.baseline
39+
40+
build:
41+
needs: detect-secrets
42+
name: Build/Test (Java ${{matrix.java-version}})
43+
runs-on: ubuntu-latest
44+
strategy:
45+
matrix:
46+
java-version: ['11', '17']
47+
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
52+
- name: Setup Java ${{matrix.java-version}}
53+
uses: actions/setup-java@v4
54+
with:
55+
java-version: ${{matrix.java-version}}
56+
distribution: 'adopt'
57+
cache: 'maven'
58+
59+
- name: Build & Test
60+
run: mvn -B clean verify -fae -DskipITs
61+
62+
create-release:
63+
needs: build
64+
name: Semantic-Release
65+
if: "github.ref_name == 'main' && github.event_name != 'pull_request'"
66+
runs-on: ubuntu-latest
67+
68+
steps:
69+
- name: Checkout repository
70+
uses: actions/checkout@v4
71+
with:
72+
persist-credentials: false
73+
74+
- name: Setup Node.js
75+
uses: actions/setup-node@v4
76+
with:
77+
node-version: 22
78+
79+
- name: Setup Python
80+
uses: actions/setup-python@v5
81+
with:
82+
python-version: 3.12
83+
84+
- name: Install Publishing Tools
85+
run: |
86+
pip install bump-my-version
87+
npm install
88+
89+
- name: Run semantic-release
90+
env:
91+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
92+
run: npm run semantic-release

.github/workflows/publish.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This workflow is responsible for:
2+
# - publishing artifacts to Maven Central
3+
# - building and publishing javadocs to the git repository.
4+
# It is triggered when a new release is created.
5+
6+
name: Publish
7+
8+
on:
9+
release:
10+
types: [created]
11+
workflow_dispatch:
12+
# Allow this workflow to be triggered manually
13+
14+
jobs:
15+
publish:
16+
name: Publish Release
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
persist-credentials: false
24+
25+
- name: Setup Java
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: 11
29+
distribution: 'adopt'
30+
cache: 'maven'
31+
# Configure ~/.m2/settings.xml
32+
server-id: ossrh
33+
server-username: OSSRH_USERNAME
34+
server-password: OSSRH_PASSWORD
35+
# Import GPG key into build agent's local keystore
36+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
37+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
38+
39+
- name: Set artifact version to ${{ github.ref_name }}
40+
run: mvn -B versions:set -DnewVersion=${{ github.ref_name}} -DgenerateBackupPoms=false
41+
42+
- name: Publish Javadocs
43+
env:
44+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
45+
GH_REPO_SLUG: ${{ github.repository }}
46+
GH_TAG: ${{ github.ref_name}}
47+
run: |
48+
mvn -B clean javadoc:aggregate
49+
build/publishJavadoc-gha.sh
50+
51+
- name: Publish to Maven Central
52+
env:
53+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
54+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
55+
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
56+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
57+
run: |
58+
mvn -B deploy -DskipTests -P central

.secrets.baseline

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "package-lock.json|go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2024-10-23T11:25:21Z",
6+
"generated_at": "2025-01-09T17:12:18Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -65,6 +65,16 @@
6565
}
6666
],
6767
"results": {
68+
".github/workflows/publish.yaml": [
69+
{
70+
"hashed_secret": "87ddb19c18c56534a4011f47f38530f6df9a8a80",
71+
"is_secret": false,
72+
"is_verified": false,
73+
"line_number": 34,
74+
"type": "Secret Keyword",
75+
"verified_result": null
76+
}
77+
],
6878
"modules/context-based-restrictions/src/test/java/com/ibm/cloud/platform_services/context_based_restrictions/v1/ContextBasedRestrictionsIT.java": [
6979
{
7080
"hashed_secret": "125fbc14773f228e72f16d55be21bad750d30b19",

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
-->
2121

2222
<!-- This is the version associated with the Java core. -->
23-
<sdk-core-version>9.22.0</sdk-core-version>
23+
<sdk-core-version>9.22.2</sdk-core-version>
2424

2525
<testng-version>7.10.2</testng-version>
2626
<okhttp3-version>4.12.0</okhttp3-version>

0 commit comments

Comments
 (0)