Skip to content

Update

Update #12

Workflow file for this run

name: Maven Generate Javadoc
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Import GPG key
run: |
echo "${{ secrets.GPG_SECRET }}" | gpg --batch --yes --import
env:
GPG_TTY: $(tty)
- name: Install with Maven
run: mvn clean install -DskipTests -Dgpg.passphrase=${{ secrets.GPG_PASSWORD }}
- name: Build and generate Javadoc
run: mvn javadoc:javadoc
- name: Deploy to gh-pages
run: |
echo "Listing all directories containing target/site/apidocs"
for dir in $(find . -type d -path '*target/site/apidocs'); do
echo "Processing $dir"
# Remove the prefix './' and suffix 'target/site/apidocs', to get relative path of module
parent_dir=${dir%target/site/apidocs}
# Create corresponding directory
mkdir -p "/tmp/javadoc/${parent_dir}"
# Copy Javadoc to corresponding directory
cp -R "$dir/"* "/tmp/javadoc/${parent_dir}"
done
git config --global user.name "HamaWhiteGG"
git config --global user.email "baisongxx@gmail.com"
git checkout --orphan gh-pages
git reset --hard
git clean -df
cp -R /tmp/javadoc/* .
git add .
git commit -m "Update Javadoc" || true
git push origin gh-pages --force
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}