Skip to content

Commit d04e9ea

Browse files
committed
chore: fix github actions issues
Signed-off-by: BRIAN GLEESON <Brian.Gleeson@ie.ibm.com>
1 parent ba86aa6 commit d04e9ea

File tree

6 files changed

+22
-78
lines changed

6 files changed

+22
-78
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup Python
2525
uses: actions/setup-python@v5
2626
with:
27-
python-version: 3.12
27+
python-version: 3.11
2828

2929
- name: Install detect-secrets
3030
run: |

.github/workflows/publish.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
name: release
1+
name: publish
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
release:
5+
types: [created]
76
workflow_dispatch:
87
inputs:
98
publish_maven:
109
description: 'Publish to Maven'
1110
required: false
1211
type: boolean
1312
default: true
14-
inputs:
1513
publish_javadoc:
1614
description: 'Publish JavaDoc to gh-pages branch'
1715
required: false
@@ -29,10 +27,11 @@ jobs:
2927
runs-on: ubuntu-latest
3028
timeout-minutes: 30
3129
# 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)
30+
# if: (github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release):')) || (github.event_name == 'workflow_dispatch' && inputs.publish_javadoc)
3331

3432
permissions:
3533
contents: write
34+
pages: write
3635

3736
steps:
3837
- name: Checkout code
@@ -52,9 +51,9 @@ jobs:
5251

5352
- name: Publish Javadocs
5453
env:
55-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
56-
GH_REPO_SLUG: ${{ github.repository }}
57-
GH_TAG: ${{ github.ref_name}}
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
GITHUB_REPO_SLUG: ${{ github.repository }}
56+
GITHUB_TAG: ${{ github.ref_name}}
5857
run: |
5958
mvn clean javadoc:aggregate --settings build/.github.settings.xml
6059
build/publishJavadoc-gha.sh
@@ -63,11 +62,10 @@ jobs:
6362
# Requires GPG_KEYNAME, GPG_PRIVATE_KEY, GPG_PASSPHRASE, CP_USERNAME, CP_PASSWORD
6463
# Missing: GPG_PRIVATE_KEY, GPG_PASSPHRASE, CP_PASSWORD
6564
name: Publish to Maven Central
66-
needs: semantic-release
6765
runs-on: ubuntu-latest
6866
timeout-minutes: 30
6967
# 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)
68+
# if: (github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release):')) || (github.event_name == 'workflow_dispatch' && inputs.publish_maven)
7169

7270
steps:
7371
- name: Checkout code

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 ${GH_TAG} | sed 's/^.*/ <li><a href="docs\/&">Latest release<\/a><\/li>/'
26+
echo ${GITHUB_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: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
#!/bin/bash
22

33
# Required environment variables:
4-
# GH_TOKEN
5-
# GH_REPO_SLUG
6-
# GH_TAG
4+
# GITHUB_TOKEN
5+
# GITHUB_REPO_SLUG
6+
# GITHUB_TAG
77

8-
printf "\n>>>>> Publishing javadoc for release build: repo=%s tag=%s\n" ${GH_REPO_SLUG} ${GH_TAG}
8+
printf "\n>>>>> Publishing javadoc for release build: repo=%s tag=%s\n" ${GITHUB_REPO_SLUG} ${GITHUB_TAG}
99

1010
printf "\n>>>>> Cloning repository's gh-pages branch into directory 'gh-pages'\n"
1111
rm -fr ./gh-pages
1212
git config --global user.email "devxsdk@us.ibm.com"
1313
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
14+
git clone --branch=gh-pages https://${GITHUB_TOKEN}@github.com/${GITHUB_REPO_SLUG}.git gh-pages
1515

1616
printf "\n>>>>> Finished cloning...\n"
1717

1818
pushd gh-pages
1919

2020
# 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}
21+
printf "\n>>>>> Copying javadocs to new directory: docs/%s\n" ${GITHUB_TAG}
22+
rm -rf docs/${GITHUB_TAG}
23+
mkdir -p docs/${GITHUB_TAG}
24+
cp -rf ../target/site/apidocs/* docs/${GITHUB_TAG}
2525

2626
printf "\n>>>>> Generating gh-pages index.html...\n"
2727
../build/generateJavadocIndex.sh > index.html
2828

2929
printf "\n>>>>> Committing new javadoc...\n"
3030
git add -f .
31-
git commit -m "docs: latest javadoc for ${GH_TAG}"
31+
git commit -m "docs: latest javadoc for ${GITHUB_TAG}"
3232
git push -f origin gh-pages
3333

3434
popd
3535

36-
printf "\n>>>>> Published javadoc for release build: repo=%s tag=%s\n" ${GH_REPO_SLUG} ${GH_TAG}
36+
printf "\n>>>>> Published javadoc for release build: repo=%s tag=%s\n" ${GITHUB_REPO_SLUG} ${GITHUB_TAG}

build/publishJavadoc.sh

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

build/setMavenVersion.sh

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

0 commit comments

Comments
 (0)