Skip to content

Commit ba86aa6

Browse files
committed
fix: migrate to github actions build
Signed-off-by: BRIAN GLEESON <Brian.Gleeson@ie.ibm.com>
1 parent 5e70d62 commit ba86aa6

File tree

9 files changed

+265
-98
lines changed

9 files changed

+265
-98
lines changed

.github/workflows/pr.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: pr
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
# Allow workflow to be triggered manually.
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
detect-secrets:
16+
name: detect-secrets
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 30
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: 3.12
28+
29+
- name: Install detect-secrets
30+
run: |
31+
pip install --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets"
32+
33+
- name: Run detect-secrets
34+
run: |
35+
detect-secrets scan --update .secrets.baseline
36+
detect-secrets -v audit --report --fail-on-unaudited --fail-on-live --fail-on-audited-real .secrets.baseline
37+
38+
build-test:
39+
name: Build and Test (Java ${{ matrix.java-version }})
40+
needs: detect-secrets
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 30
43+
strategy:
44+
matrix:
45+
java-version: ['11', '17']
46+
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: Set up Java ${{ matrix.java-version }}
52+
uses: actions/setup-java@v4
53+
with:
54+
java-version: ${{ matrix.java-version }}
55+
distribution: 'temurin'
56+
cache: 'maven'
57+
58+
- name: Build and test
59+
run: mvn verify -fae -DskipITs --settings build/.github.settings.xml

.github/workflows/publish.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
publish_maven:
10+
description: 'Publish to Maven'
11+
required: false
12+
type: boolean
13+
default: true
14+
inputs:
15+
publish_javadoc:
16+
description: 'Publish JavaDoc to gh-pages branch'
17+
required: false
18+
type: boolean
19+
default: true
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
# JavaDoc has not been published for a very long time.
27+
publish-javadoc:
28+
name: Publish Javadoc
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 30
31+
# Only publish when semantic-release creates a release commit (starts with "chore(release):")
32+
if: (github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release):')) || (github.event_name == 'workflow_dispatch' && inputs.publish_javadoc)
33+
34+
permissions:
35+
contents: write
36+
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Set up Java 11
44+
uses: actions/setup-java@v4
45+
with:
46+
java-version: '11'
47+
distribution: 'temurin'
48+
cache: 'maven'
49+
50+
- name: Set artifact version to ${{ github.ref_name }}
51+
run: mvn -B versions:set -DnewVersion=${{ github.ref_name}} -DgenerateBackupPoms=false
52+
53+
- name: Publish Javadocs
54+
env:
55+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
56+
GH_REPO_SLUG: ${{ github.repository }}
57+
GH_TAG: ${{ github.ref_name}}
58+
run: |
59+
mvn clean javadoc:aggregate --settings build/.github.settings.xml
60+
build/publishJavadoc-gha.sh
61+
62+
publish-maven-central:
63+
# Requires GPG_KEYNAME, GPG_PRIVATE_KEY, GPG_PASSPHRASE, CP_USERNAME, CP_PASSWORD
64+
# Missing: GPG_PRIVATE_KEY, GPG_PASSPHRASE, CP_PASSWORD
65+
name: Publish to Maven Central
66+
needs: semantic-release
67+
runs-on: ubuntu-latest
68+
timeout-minutes: 30
69+
# Only publish when semantic-release creates a release commit (starts with "chore(release):")
70+
if: (github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release):')) || (github.event_name == 'workflow_dispatch' && inputs.publish_maven)
71+
72+
steps:
73+
- name: Checkout code
74+
uses: actions/checkout@v4
75+
76+
- name: Set up Java 11
77+
uses: actions/setup-java@v4
78+
with:
79+
java-version: '11'
80+
distribution: 'temurin'
81+
cache: 'maven'
82+
83+
- name: Import GPG key
84+
env:
85+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
86+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
87+
run: |
88+
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
89+
gpg --list-secret-keys --keyid-format LONG
90+
91+
- name: Set Maven version
92+
run: mvn versions:set -DnewVersion=${{ github.ref_name }} -DgenerateBackupPoms=false
93+
94+
- name: Deploy to Maven Central
95+
env:
96+
# Required variables and secrets for publishing to Maven Central
97+
# GNU Privacy Guard variables
98+
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
99+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
100+
# Central portal username and password
101+
CP_USERNAME: ${{ secrets.CP_USERNAME }}
102+
CP_PASSWORD: ${{ secrets.CP_PASSWORD }}
103+
run: |
104+
mvn deploy --settings build/.github.settings.xml -DskipTests -P central

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
dry_run:
10+
description: 'Run semantic-release in dry-run mode'
11+
required: false
12+
type: boolean
13+
default: true
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
semantic-release:
21+
name: Semantic Release
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 30
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
persist-credentials: false
30+
fetch-depth: 0
31+
32+
- name: Set up Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: '24'
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.12'
41+
42+
- name: Install Node.js dependencies
43+
run: npm install
44+
45+
- name: Install bump-my-version
46+
run: pip install bump-my-version
47+
48+
- name: Semantic Release (Dry Run)
49+
if: github.event_name == 'workflow_dispatch' && inputs.dry_run
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
53+
run: npm run semantic-release -- --dry-run
54+
55+
- name: Semantic Release
56+
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.dry_run)
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
60+
run: npm run semantic-release

.travis.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# IBM Cloud Continuous Delivery Java SDK Version 2.0.4
1+
# IBM Cloud Continuous Delivery Java SDK Version
22

33
[![Build Status](https://app.travis-ci.com/IBM/continuous-delivery-java-sdk.svg?branch=main)](https://app.travis-ci.com/github/IBM/continuous-delivery-java-sdk)
44
[![Release](https://img.shields.io/github/v/release/IBM/continuous-delivery-java-sdk)](https://github.com/IBM/continuous-delivery-java-sdk/releases/latest)
@@ -21,7 +21,7 @@ The Java client library to interact with the [IBM Cloud Continuous Delivery Tool
2121

2222
<!-- toc -->
2323

24-
- [IBM Cloud Continuous Delivery Java SDK Version 2.0.4](#ibm-cloud-continuous-delivery-java-sdk-version-203)
24+
- [IBM Cloud Continuous Delivery Java SDK Version](#ibm-cloud-continuous-delivery-java-sdk-version)
2525
- [Table of Contents](#table-of-contents)
2626
- [Overview](#overview)
2727
- [Prerequisites](#prerequisites)
@@ -97,13 +97,6 @@ compile 'com.ibm.cloud:cd-tekton-pipeline:2.0.4'
9797

9898
For general SDK usage information, please see [this link](https://github.com/IBM/ibm-cloud-sdk-common/blob/main/README.md)
9999

100-
## Questions
101-
102-
If you are having difficulties using this SDK or have a question about the IBM Cloud services,
103-
please ask a question at
104-
[Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud).
105-
Alternatively, you can reach out to the IBM Cloud Continuous Delivery development team by joining us on [Slack](https://ic-devops-slack-invite.us-south.devops.cloud.ibm.com/).
106-
107100
## Issues
108101

109102
If you encounter an issue with the project, you are welcome to submit a

build/generateJavadocIndex.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ echo '<!DOCTYPE html>
2323
2424
<p>Javadoc by release:</p>
2525
<ul>'
26-
echo ${TRAVIS_TAG} | sed 's/^.*/ <li><a href="docs\/&">Latest release<\/a><\/li>/'
26+
echo ${GH_TAG} | sed 's/^.*/ <li><a href="docs\/&">Latest release<\/a><\/li>/'
2727
ls docs | grep --invert-match index.html | sed 's/^.*/ <li><a href="docs\/&">&<\/a><\/li>/'
2828
echo ' </ul>
2929
</div>

build/publishJavadoc-gha.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Required environment variables:
4+
# GH_TOKEN
5+
# GH_REPO_SLUG
6+
# GH_TAG
7+
8+
printf "\n>>>>> Publishing javadoc for release build: repo=%s tag=%s\n" ${GH_REPO_SLUG} ${GH_TAG}
9+
10+
printf "\n>>>>> Cloning repository's gh-pages branch into directory 'gh-pages'\n"
11+
rm -fr ./gh-pages
12+
git config --global user.email "devxsdk@us.ibm.com"
13+
git config --global user.name "ibm-devx-sdk"
14+
git clone --branch=gh-pages https://${GH_TOKEN}@github.com/IBM/${GH_REPO_SLUG}.git gh-pages
15+
16+
printf "\n>>>>> Finished cloning...\n"
17+
18+
pushd gh-pages
19+
20+
# Create a new directory for this branch/tag and copy the javadocs there.
21+
printf "\n>>>>> Copying javadocs to new directory: docs/%s\n" ${GH_TAG}
22+
rm -rf docs/${GH_TAG}
23+
mkdir -p docs/${GH_TAG}
24+
cp -rf ../target/site/apidocs/* docs/${GH_TAG}
25+
26+
printf "\n>>>>> Generating gh-pages index.html...\n"
27+
../build/generateJavadocIndex.sh > index.html
28+
29+
printf "\n>>>>> Committing new javadoc...\n"
30+
git add -f .
31+
git commit -m "docs: latest javadoc for ${GH_TAG}"
32+
git push -f origin gh-pages
33+
34+
popd
35+
36+
printf "\n>>>>> Published javadoc for release build: repo=%s tag=%s\n" ${GH_REPO_SLUG} ${GH_TAG}

0 commit comments

Comments
 (0)