Skip to content

Commit

Permalink
Merge pull request cf-convention#554 from cofinoa/main
Browse files Browse the repository at this point in the history
Updating build and publish
  • Loading branch information
cofinoa authored Oct 22, 2024
2 parents d576ae4 + 80f4f00 commit 8837f6b
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 76 deletions.
19 changes: 19 additions & 0 deletions .github/gh-pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">

<body>
<h1>CF Conventions and Conformance</h1>
<h2>Latest</h2>
<h3>CF Conventions</h3>
<ul>
<li><a href="cf-conventions.html">HTML</a></li>
<li><a href="cf-conventions.pdf" >PDF </a></li>
</ul>
<h3>Conformance</h3>
<ul>
<li><a href="conformance.html">HTML</a></li>
<li><a href="conformance.pdf" >PDF </a></li>
</ul>
</body>

</html>
70 changes: 20 additions & 50 deletions .github/workflows/adoc_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ on:
- published
jobs:
# Job to build cf-conventions.html, cf-conventions.pdf
build_conventions:
name: Build cf-conventions html and pdf
build_conventions_and_conformance:
name: Build cf-conventions and conformance html and pdf
runs-on: ubuntu-latest
steps:
# Check out PR
Expand All @@ -49,64 +49,32 @@ jobs:
run: |
echo "CF_FINAL=True" >> "$GITHUB_ENV"
# Build cf-conventions.html using the Analog-inc asciidoctor-action
- name: Build cf-conventions.html
- name: Make ALL
uses: Analog-inc/asciidoctor-action@v1
with:
shellcommand: 'make conventions-html'
# Build cf-conventions.pdf using the Analog-inc asciidoctor-action
- name: Build cf-conventions.pdf
uses: Analog-inc/asciidoctor-action@v1
with:
shellcommand: 'make conventions-pdf'
# Upload artifact containing cf-conventions.html, cf-conventions.pdf
- name: Save cf-conventions doc preview
uses: actions/upload-artifact@v4
with:
name: conventions_docs
path: conventions_build/
# Job to build conformance.html, conformance.pdf
build_conformance:
name: Build conformance html and pdf
runs-on: ubuntu-latest
steps:
# Checkout PR
- uses: actions/checkout@v4
# Create build directory
- run: mkdir conformance_build
# If it is release event, tag for final
- name: If it is a release add the "final" tag and date timestamp formatting
if: github.event_name == 'release'
shellcommand: 'make all'
- name: Copy index.html
run: |
echo "CF_FINAL=True" >> "$GITHUB_ENV"
# Build conformance.html using the Analog-inc asciidoctor-action
- name: Build conformance.html
uses: Analog-inc/asciidoctor-action@v1
with:
shellcommand: 'make conformance-html'
# Build conformance.pdf using the Analog-inc asciidoctor-action
- name: Build conformance.pdf
uses: Analog-inc/asciidoctor-action@v1
with:
shellcommand: 'make conformance-pdf'
# Upload artifact containing conformance.html, conformance.pdf
- name: Save conformance doc preview
sudo cp -p .github/gh-pages/index.html build/
# Upload artifact containing cf-conventions.html, cf-conventions.pdf
- name: Save cf-conventions and conformance docs
uses: actions/upload-artifact@v4
with:
name: conformance_docs
path: conformance_build/

name: convention_and_conformance_docs
path: build/
# Use artifacts from the build_conventions, build_conformance, and
# images_artifact jobs to update the gh-pages branch. The location of the
# files to be updated depend on whether the job it triggered from a PR merge
# into main (files in the base directory are updated), or if the job is
# triggered by the publication of a release on github (new files are created
# in a directory named after the release name).
publish:
name: Release cf-conventions html and pdf
name: Release cf-conventions and conformance html and pdf
# Do not run on pull requests
if: github.event_name != 'pull_request'
# Wait for the build artifacts to become available
needs: [build_conventions, build_conformance]
needs: [build_conventions_and_conformance]
runs-on: ubuntu-latest
steps:
# Checkout gh-pages branch
Expand All @@ -127,6 +95,7 @@ jobs:
# build/ directory
- uses: actions/download-artifact@v4
with:
name: convention_and_conformance_docs
path: build/
# If we are doing a release, we need to create the release directory
- name: Make release directory
Expand All @@ -139,10 +108,11 @@ jobs:
run: rm -rf ${{ env.TARGET_DIR }}/images
- name: Copy conventions and conformance documents
run: |
cp build/conventions_docs/cf-conventions.html ${{ env.TARGET_DIR }}/
cp build/conventions_docs/cf-conventions.pdf ${{ env.TARGET_DIR }}/
cp build/conformance_docs/conformance.html ${{ env.TARGET_DIR }}/
cp build/conformance_docs/conformance.pdf ${{ env.TARGET_DIR }}/
cp -p build/cf-conventions.html ${{ env.TARGET_DIR }}/
cp -p build/cf-conventions.pdf ${{ env.TARGET_DIR }}/
cp -p build/conformance.html ${{ env.TARGET_DIR }}/
cp -p build/conformance.pdf ${{ env.TARGET_DIR }}/
cp -p build/index.html ${{ env.TARGET_DIR }}/
# Remove the directory that held the artifacts so that it does not get
# committed to the gh-pages branch
- name: Remove artifact directory
Expand All @@ -152,7 +122,7 @@ jobs:
- name: Update release index.html to point to new release
if: github.event_name == 'release'
run: |
sed s/Latest/"${GITHUB_REF##*/}"/ index.html > ${{ env.TARGET_DIR }}/index.html;
sed -i s/Latest/"${GITHUB_REF##*/}"/ ${{ env.TARGET_DIR }}/index.html;
# Stage all changed files to git
- name: Add all changes to git
run: git add --all
Expand Down
23 changes: 14 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MAIN_DOC := cf-conventions
BUILD_DIR := build

MAIN_DOC_BUILD_DIR := conventions_build
MAIN_DOC := cf-conventions
MAIN_DOC_BUILD_DIR := $(BUILD_DIR)

MAIN_DOC_INC := version toc-extra
MAIN_DOC_INC += ch01 ch02 ch03 ch04 ch05 ch06 ch07 ch08 ch09
Expand All @@ -25,7 +26,7 @@ MAIN_DOC_IMG := $(addprefix images/, $(MAIN_DOC_IMG))

CONF_DOC := conformance

CONF_DOC_BUILD_DIR := conformance_build
CONF_DOC_BUILD_DIR := $(BUILD_DIR)

CONF_DOC_INC := conformance.adoc version.adoc

Expand Down Expand Up @@ -67,15 +68,19 @@ $(CONF_DOC_BUILD_DIR)/$(CONF_DOC).html: $(CONF_DOC_INC) | $(CONF_DOC_BUILD_DIR)
$(CONF_DOC_BUILD_DIR)/$(CONF_DOC).pdf: $(CONF_DOC_INC) | $(CONF_DOC_BUILD_DIR)
asciidoctor-pdf --verbose --trace ${FINAL_TAG} -d book $(CONF_DOC).adoc -D $(CONF_DOC_BUILD_DIR)

$(MAIN_DOC_BUILD_DIR):
mkdir -vp $(MAIN_DOC_BUILD_DIR)
#$(MAIN_DOC_BUILD_DIR):
# mkdir -vp $(MAIN_DOC_BUILD_DIR)

#$(CONF_DOC_BUILD_DIR):
# mkdir -vp $(CONF_DOC_BUILD_DIR)

$(CONF_DOC_BUILD_DIR):
mkdir -vp $(CONF_DOC_BUILD_DIR)
$(BUILD_DIR):
mkdir -vp $(BUILD_DIR)

clean:
rm -rvf $(MAIN_DOC_BUILD_DIR)
rm -rvf $(CONF_DOC_BUILD_DIR)
# rm -rvf $(MAIN_DOC_BUILD_DIR)
# rm -rvf $(CONF_DOC_BUILD_DIR)
rm -rvf $(BUILD_DIR)

#Rules to build non-static images. See MAIN_DOC_IMG_BLD above
images/cfdm_cf_concepts.svg: images/cfdm_cf_concepts.gv
Expand Down
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Their implementation in GitHub is described in this repository's [CONTRIBUTING.m

# Building the HTML

To convert the AsciiDoc files into the resulting HTML file:

1. Ensure you have [Ruby](https://www.ruby-lang.org/) installed (e.g. `sudo apt install ruby`)
1. Ensure you have a recent version of [Asciidoctor](https://asciidoctor.org/) installed (e.g. `gem install asciidoctor`)
1. Ensure you have [Make](https://www.gnu.org/software/make/) installed (e.g. `sudo apt install make`)
1. Get hold of the AsciiDoc files in this repo (e.g. `git clone [email protected]:cf-convention/cf-conventions.git`)
1. There are different options to make the conventions and conformance documents:
- (All, the default) HTML and PDF conventions and conformance documents:
The following steps outline how to build the CF Conventions documentation into HTML and/or PDF format using AsciiDoc:

1. Ensure you have [Ruby](https://www.ruby-lang.org/) installed. (e.g. `sudo apt install ruby`)
2. Ensure you have a recent version of [Asciidoctor](https://asciidoctor.org/) installed (e.g. `gem install asciidoctor`)
3. Ensure you have [Make](https://www.gnu.org/software/make/) installed. (e.g. `sudo apt install make`)
4. Clone the repository containing the AsciiDoc files. (e.g. `git clone [email protected]:cf-convention/cf-conventions.git`)
5. There are different options to make the conventions and conformance documents:
- (Default: Build all formats) HTML and PDF conventions and conformance documents:
`make` or `make all`
- HTML conventions and conformance documents:
`make html`
Expand All @@ -29,20 +29,22 @@ To convert the AsciiDoc files into the resulting HTML file:
`make conventions`
- Conformance documents (HTML and PDF):
`make conformance`
- Delete documents and build directories:
- Remove built documents and clean build directories:
`make clean`
- Build with FINAL tag and date stamp (remember to update version in `version.adoc` file ):
- Build with the FINAL tag and a date stamp. Ensure you have manually updated the version in the `version.adoc` file before running this command:
`make CF_FINAL=True`

Both HTML documents are build with images embeded into the `.html` file.
Both HTML documents will have images embedded within `.html` file.

The build documents will be rendered into local paths:
- `conventions_build/cf-conventions.html`
- `conventions_build/cf-conventions.pdf`
- `conformance_build/conformance.html`
- `conformance_build/conformance.pdf`
The built documents will be rendered in the `build` directory with the resulting paths:
- `build/cf-conventions.html`
- `build/cf-conventions.pdf`
- `build/conformance.html`
- `build/conformance.pdf`

See the [GitHub help](https://help.github.com/) pages and plethora of other git/GitHub guides for more details on how to work with repos, forks, pull requests, etc.
Ensure the built documents meet your requirements before publishing.

See the [GitHub help](https://help.github.com/) pages and many other git/GitHub guides for more details on how to work with repos, forks, pull requests, etc.

## Latest Spec Build

Expand Down
1 change: 1 addition & 0 deletions images/order_horizontal_bounds__1D_coord_variables.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env Rscript
# R version: >= 4.0.0
# r-svglite version: >= 2.0.0
library(svglite)
Expand Down
1 change: 1 addition & 0 deletions images/order_horizontal_bounds__2D_coord_variables.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env Rscript
# R version: >= 4.0.0
# r-svglite version: >= 2.0.0
library(svglite)
Expand Down

0 comments on commit 8837f6b

Please sign in to comment.