Skip to content

Commit

Permalink
merge site-docs with antora and antora-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Apr 25, 2023
1 parent 5a6d944 commit 994ec59
Show file tree
Hide file tree
Showing 139 changed files with 27,308 additions and 20 deletions.
79 changes: 79 additions & 0 deletions .github/actions/antora_publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: 'Antora Publish'
description: 'Build and Publish an Antora documentation website'
inputs:
playbook:
description: 'The playbook file.'
required: false
default: 'playbook.yml'
artifact:
description: 'Name of the artifact with the Antora website'
required: false
default: ''
options:
description: 'Extra antora options'
required: false
default: ''
extensions:
description: 'A comma separated list of antora extensions to install (ex: @antora/lunr-extension)'
required: false
default: ''
publish_pages:
description: 'Publish to GitHub Pages'
required: false
default: 'false'
github_token:
description: 'The GitHub token for GitHub Pages'
required: false
default: ''
setup_only:
description: 'If true, we only setup antora but do not run it'
required: false
default: 'false'

runs:
using: "composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install package.json
shell: bash
run: |
if test -f "package.json"; then
npm install
fi
- name: Install Antora
shell: bash
run: npm i antora

- name: Install Antora Extensions
if: inputs.extensions != ''
shell: bash
run: |
extensions=${{ inputs.extensions }}
for extension in ${extensions//,/ }
do
npm i "$extension"
done
- name: Generate Site
if: inputs.setup_only != 'true'
shell: bash
run: npx antora ${{ inputs.options }} ${{ inputs.playbook }}

- name: Publish as Artifact
if: inputs.artifact != '' && inputs.setup_only != 'true'
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact }}
path: build

- name: Publish to GitHub Pages
if: inputs.github_token != '' && inputs.publish_pages != false && inputs.setup_only != 'true'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ inputs.github_token }}
publish_dir: build
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Upload Antora Docs
on:
push:
branches:
- '*'
pull_request:
branches:
- master
- develop

concurrency:
group: ${{format('publish-{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true

jobs:
build:
name: Publish Antora Docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Antora Setup
uses: ./.github/actions/antora_publish
with:
setup_only: true

- name: Build
run: |
./libdoc.sh "${{ (startsWith(github.ref, 'refs/heads/develop') && 'develop') || 'master' }}"
./sitedoc.sh "${{ (startsWith(github.ref, 'refs/heads/develop') && 'develop') || 'master' }}"
# - name: AWS Sync
# if: github.event_name == 'push' && (startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/master'))
# uses: jakejarvis/s3-sync-action@master
# with:
# args: --follow-symlinks --delete
# env:
# AWS_S3_BUCKET: ${{ (startsWith(github.ref, 'refs/heads/develop') && secrets.AWS_DEVELOP_S3_BUCKET) || secrets.AWS_MASTER_S3_BUCKET }}
# AWS_ACCESS_KEY_ID: ${{ (startsWith(github.ref, 'refs/heads/develop') && secrets.AWS_DEVELOP_ACCESS_KEY_ID) || secrets.AWS_MASTER_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ (startsWith(github.ref, 'refs/heads/develop') && secrets.AWS_DEVELOP_SECRET_ACCESS_KEY) || secrets.AWS_MASTER_SECRET_ACCESS_KEY }}
# AWS_REGION: 'us-east-2'
# SOURCE_DIR: ${{ format('build/{0}', (startsWith(github.ref, 'refs/heads/develop') && 'develop') || 'master') }}
# DEST_DIR: ${{ format('site/{0}', (startsWith(github.ref, 'refs/heads/develop') && 'develop') || 'master') }}

45 changes: 45 additions & 0 deletions .github/workflows/ui-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish Antora-UI bundle

on:
push:
branches: [ "master", "develop" ]
pull_request:
branches: [ "master", "develop" ]

concurrency:
group: ${{format('ui-release-{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
if: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' }}
permissions:
contents: write

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Build
working-directory: antora-ui
run: |
npm install
gulp bundle
- name: Bundle
uses: svenstaro/upload-release-action@2.5.0
with:
tag: ui-${{ github.ref_name }}
file: antora-ui/build/ui-bundle.zip
asset_name: ui-bundle.zip
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
antora
build
temp/
local.*
node_modules/
Loading

0 comments on commit 994ec59

Please sign in to comment.