Update address on copyright #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build_deploy | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
repository_dispatch: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
# | |
# Build the Jekyll site | |
# | |
build-site: | |
name: Build site | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Calculate cache key | |
id: cache-key | |
run: | | |
echo "cache-key=$(scripts/metacachekey jekyll _config.yml)" >> $GITHUB_OUTPUT | |
- name: Restore cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: _site | |
key: ${{ steps.cache-key.outputs.cache-key }} | |
- name: Use Ruby | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: 3.3 | |
- name: Build site | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
bundle exec jekyll build | |
- name: Save artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jekyll-site | |
path: _site | |
# | |
# For each document category (administrative, standard, etc.), | |
# build using `metanorma site generate`. | |
# | |
build-docs: | |
name: Build ${{ matrix.doc_type }} docs | |
runs-on: ubuntu-latest | |
container: | |
image: metanorma/metanorma:latest | |
strategy: | |
matrix: | |
doc_type: | |
- administrative | |
- directive | |
- pending-publication | |
- public-review | |
- report | |
- specification | |
- standard | |
- advisory | |
- amendment | |
- guide | |
- technical-corrigendum | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 1 | |
- name: Calculate cache key | |
id: cache-key | |
run: | | |
echo "cache-key=$(scripts/metacachekey metanorma src-documents/metanorma-${{ matrix.doc_type }}.yml)" >> $GITHUB_OUTPUT | |
- name: Restore cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: _site/${{ matrix.doc_type }} | |
key: ${{ steps.cache-key.outputs.cache-key }} | |
- name: Metanorma generate site | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions-mn/build-and-publish@main | |
with: | |
destination: artifact | |
agree-to-terms: true | |
output-dir: _site/${{ matrix.doc_type }} | |
artifact-name: metanorma-docs-${{ matrix.doc_type }} | |
source-path: ./ | |
config-file: src-documents/metanorma-${{ matrix.doc_type }}.yml | |
- name: Save artifacts | |
if: steps.cache.outputs.cache-hit == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: metanorma-docs-${{ matrix.doc_type }} | |
path: _site/${{ matrix.doc_type }} | |
# | |
# At the very end, integrate them all with Jekyll. | |
# | |
check-artifacts: | |
name: Check aggregating artifacts with site | |
runs-on: ubuntu-latest | |
needs: [build-site, build-docs] | |
env: | |
BUNDLE_GEMFILE: ${{ github.workspace }}/src-documents/Gemfile | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Download Jekyll artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: jekyll-site | |
path: _site | |
- name: Download all doc artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "metanorma-docs-*" | |
path: _site | |
merge-multiple: false | |
- name: Fix doc artifacts paths | |
shell: bash | |
run: | | |
for dir in _site/metanorma-docs-*; do | |
mv "$dir" "${dir/metanorma-docs-}" | |
done | |
- name: Use Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: 3.3 | |
- name: Build Relaton index files | |
shell: bash | |
run: | | |
make build-relaton | |
- name: Debug | |
if: ${{ github.ref != 'refs/heads/main' }} | |
run: | | |
ls -al | |
ls -alR _site | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
# | |
# Deploy to GitHub Pages | |
# | |
deploy: | |
if: ${{ github.ref == 'refs/heads/main' }} | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: check-artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |