Skip to content

Commit

Permalink
Simplify make to one step and update index.html update and output
Browse files Browse the repository at this point in the history
  • Loading branch information
cofinoa committed Oct 22, 2024
1 parent 830bd10 commit 8a871cf
Showing 1 changed file with 20 additions and 51 deletions.
71 changes: 20 additions & 51 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
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,7 +95,7 @@ jobs:
# build/ directory
- uses: actions/download-artifact@v4
with:
path: build/
name: convention_and_conformance_docs
# If we are doing a release, we need to create the release directory
- name: Make release directory
if: github.event_name == 'release'
Expand All @@ -139,10 +107,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 +121,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

0 comments on commit 8a871cf

Please sign in to comment.