Skip to content

Merge branch '1.0.x' #87

Merge branch '1.0.x'

Merge branch '1.0.x' #87

Workflow file for this run

# This workflow will build a Java project with Maven
name: Publish documentation to the project page
on:
push:
branches: [ main, release ]
jobs:
build:
if: github.repository == 'jdbc-observations/datasource-micrometer'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: maven
- name: Get project version
run: |
VERSION=$( ./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout )
echo "project_version=$VERSION" >> $GITHUB_ENV
# Build modules which are referenced in asciidoc creation
- name: Build modules
run: ./mvnw install -DskipTests
- name: Process asciidoc
run: ./mvnw install -Pdocs -pl docs
- name: Process javadoc
run: ./mvnw javadoc:aggregate
#
# Construct a directory to be deployed to the "github-pages" deployment environment.
# see https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#creating-a-custom-github-actions-workflow-to-publish-your-site
#
# target/deploy-documents/docs/
# `-- <PROJECT_VERSION> -- e.g. "0.9.0.BUILD-SNAPSHOT"
# `-- docs/html/
# `-- api/
# `-- CHANGELOG.txt
# `-- current-snapshot -- for latest snapshot from main
# `-- docs/html/
# `-- api/
# `-- CHANGELOG.txt
# `-- current -- for latest release version
# `-- docs/html/
# `-- api/
# `-- CHANGELOG.txt
- name: Prepare "project-version" documents
run: |
mkdir -p target/deploy-documents/docs/${{ env.project_version }}/docs/html
mkdir -p target/deploy-documents/docs/${{ env.project_version }}/api
cp -Rf docs/target/generated-docs/reference/html/* target/deploy-documents/docs/${{ env.project_version }}/docs/html/
cp -Rf target/site/apidocs/* target/deploy-documents/docs/${{ env.project_version }}/api/
cp CHANGELOG target/deploy-documents/docs/${{ env.project_version }}/CHANGELOG.txt
- name: Prepare "current-snapshot" documents
if: "github.ref == 'refs/heads/main' && contains(env.project_version, 'snapshot')"
run: |
mkdir -p target/deploy-documents/docs/current-snapshot/docs/html
mkdir -p target/deploy-documents/docs/current-snapshot/api
cp -Rf docs/target/generated-docs/reference/html/* target/deploy-documents/docs/current-snapshot/docs/html/
cp -Rf target/site/apidocs/* target/deploy-documents/docs/current-snapshot/api/
cp CHANGELOG target/deploy-documents/docs/current-snapshot/CHANGELOG.txt
- name: Prepare "current" documents
if: "!contains(env.project_version, 'snapshot')"
run: |
mkdir -p target/deploy-documents/docs/current/docs/html
mkdir -p target/deploy-documents/docs/current/api
cp -Rf docs/target/generated-docs/reference/html/* target/deploy-documents/docs/current/docs/html/
cp -Rf target/site/apidocs/* target/deploy-documents/docs/current/api/
cp CHANGELOG target/deploy-documents/docs/current/CHANGELOG.txt
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: target/deploy-documents
# # Deployment job (see https://github.com/actions/deploy-pages)
# deploy:
# permissions:
# pages: write
# id-token: write
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
# runs-on: ubuntu-latest
# needs: build
# steps:
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v1
# The deploy job creates new environment which does not contain old version docs.
# Commenting out the job and use gh-pages instead.
- name: Deploy documents
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: target/deploy-documents/docs
destination_dir: docs
keep_files: true
full_commit_message: "Deploying documents(${{ env.project_version}}) to ${{ github.ref }} from ${{ github.repository }}@${{ github.sha }}"