Skip to content

Commit

Permalink
Refactor GH action to use Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
cofinoa committed Oct 2, 2024
1 parent 25003ab commit b7e21af
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions .github/workflows/adoc_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,25 @@ jobs:
steps:
# Check out PR
- uses: actions/checkout@v4
# Create build directory
- run: mkdir conventions_build
- name: Set draft date-time formatting
if: github.event_name != 'release'
run: |
echo "DATE_FMT=+%d %B, %Y %H:%M:%SZ" >> "$GITHUB_ENV"
- name: Set "final" tag and date-time formatting
# If it is release event, tag for final
- name: Set "final" tag and date timestamp formatting
if: github.event_name == 'release'
run: |
echo "FINAL_TAG=-a final" >> "$GITHUB_ENV"; echo "DATE_FMT=+%d %B, %Y" >> "$GITHUB_ENV"
echo "CF_FINAL=True" >> "$GITHUB_ENV"
# Build cf-conventions.html using the Analog-inc asciidoctor-action
- name: Build cf-conventions.html
uses: Analog-inc/asciidoctor-action@v1.2
uses: Analog-inc/asciidoctor-action@v1
with:
shellcommand: 'asciidoctor --verbose ${FINAL_TAG} -a docprodtime=$(date -u ${DATE_FMT}) -a data-uri cf-conventions.adoc -D conventions_build'
shellcommand: 'make conventions-html'
# Patch the cfconventions.org link
- run: sed -E -i 's+(See&#160;)(https://cfconventions.org)(&#160;for&#160;further&#160;information.)+\1<a href="\2" target="_blank">\2</a>\3+' ./conventions_build/cf-conventions.html
# Build cf-conventions.pdf using the Analog-inc asciidoctor-action
- name: Build cf-conventions.pdf
uses: Analog-inc/asciidoctor-action@v1.2
uses: Analog-inc/asciidoctor-action@v1
with:
shellcommand: 'asciidoctor-pdf --verbose ${FINAL_TAG} -a docprodtime=$(date -u ${DATE_FMT}) -d book -a pdf-theme=default-theme-CF-version.yml --trace cf-conventions.adoc -D conventions_build'
shellcommand: 'make conventions-html'
# Upload artifact containing cf-conventions.html, cf-conventions.pdf
- name: Upload cf-conventions doc preview
- name: Save cf-conventions doc preview
uses: actions/upload-artifact@v4
with:
name: conventions_docs
Expand All @@ -80,22 +75,23 @@ jobs:
- uses: actions/checkout@v4
# Create build directory
- run: mkdir conformance_build
- name: Set "final" tag
# If it is release event, tag for final
- name: Set "final" tag and date timestamp formatting
if: github.event_name == 'release'
run: |
echo "FINAL_TAG=-a final" >> "$GITHUB_ENV"
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.2
uses: Analog-inc/asciidoctor-action@v1
with:
shellcommand: 'asciidoctor --verbose ${FINAL_TAG} conformance.adoc -D conformance_build'
shellcommand: 'make conformance-html'
# Build conformance.pdf using the Analog-inc asciidoctor-action
- name: Build conformance.pdf
uses: Analog-inc/asciidoctor-action@v1.2
uses: Analog-inc/asciidoctor-action@v1
with:
shellcommand: 'asciidoctor-pdf --verbose ${FINAL_TAG} -d book conformance.adoc -D conformance_build'
shellcommand: 'make conformance-pdf'
# Upload artifact containing conformance.html, conformance.pdf
- name: Upload conformance doc preview
- name: Save conformance doc preview
uses: actions/upload-artifact@v4
with:
name: conformance_docs
Expand Down

0 comments on commit b7e21af

Please sign in to comment.