Skip to content

Commit

Permalink
Actions deployment (#110)
Browse files Browse the repository at this point in the history
Here we add the publish pipeline to build the results and publish them using GitHub Pages.

This commit also updates the Readme with the new URLs and switches the publish workflow to be triggered from the master branch.
  • Loading branch information
thasso authored Sep 5, 2024
1 parent a9c3f14 commit 34aaf9e
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 23 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build Pull Request

on:
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
container:
image: ghcr.io/dash-industry-forum/dashif-specs:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}

steps:
- uses: actions/checkout@v4
- name: Build
env:
# Reset OPTS to empty to make sure we are not using
# interactive mode in CI
OPTS:
run: make -f /tools/Makefile spec SRC=Cpix.bs.md NAME=cpix

- name: Archive
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
56 changes: 56 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish

on:
push:
branches:
- master

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
packages: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
container:
image: ghcr.io/dash-industry-forum/dashif-specs:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}

steps:
- uses: actions/checkout@v4
- name: Build
env:
# Reset OPTS to empty to make sure we are not using
# interactive mode in CI
OPTS:
run: make -f /tools/Makefile spec SRC=Cpix.bs.md NAME=cpix

- name: Archive
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

package:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- uses: actions/upload-pages-artifact@v3
with:
path: dist

publish:
runs-on: ubuntu-latest
needs: package
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# The output directory contains the build output. This is not checked in to source control.
Output
Output
dist/
26 changes: 4 additions & 22 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,12 @@ We accept pull requests!

Most recent content from the **master** branch (may contain work in progress):

![Build status of master branch](https://dev.azure.com/dashif/Automation/_apis/build/status/Cpix?branchName=master)
[![Build status of master branch](https://github.com/Dash-Industry-Forum/CPIX/actions/workflows/publish.yml/badge.svg?branch=master)](https://github.com/Dash-Industry-Forum/CPIX/actions/workflows/publish.yml)

* [HTML document](https://dashif-documents.azurewebsites.net/Cpix/master/Cpix.html)
* [PDF document](https://dashif-documents.azurewebsites.net/Cpix/master/Cpix.pdf)
* [Download PDF + HTML as archive](https://dashif-documents.azurewebsites.net/Cpix/master/Cpix.zip)
* [HTML document](http://dashif.org/CPIX/)
* [PDF document](http://dashif.org/CPIX/cpix.pdf)

Most recent content from the **community-review** branch (latest version published for community review):

![Build status of community-review branch](https://dev.azure.com/dashif/Automation/_apis/build/status/Cpix?branchName=community-review)

* [HTML document](https://dashif-documents.azurewebsites.net/Cpix/community-review/Cpix.html)
* [PDF document](https://dashif-documents.azurewebsites.net/Cpix/community-review/Cpix.pdf)
* [Download PDF + HTML as archive](https://dashif-documents.azurewebsites.net/Cpix/community-review/Cpix.zip)

Most recent content from the **published** branch (final outputs published by DASH-IF):

![Build status of published branch](https://dev.azure.com/dashif/Automation/_apis/build/status/Cpix?branchName=published)

* [HTML document](https://dashif-documents.azurewebsites.net/Cpix/published/Cpix.html)
* [PDF document](https://dashif-documents.azurewebsites.net/Cpix/published/Cpix.pdf)
* [Download PDF + HTML as archive](https://dashif-documents.azurewebsites.net/Cpix/published/Cpix.zip)

[View automated build history for all branches](https://dev.azure.com/dashif/Automation/_build?definitionId=6)

# Document authoring

See [Document Authoring Kit](https://dashif.org/DocumentAuthoring/) for details on document authoring process and the relevant tooling.
See [Document Authoring Kit](https://dashif.org/DASH-IF-IOP/authoring/) for details on document authoring process and the relevant tooling.
22 changes: 22 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@echo off
set IMG=dashif/specs-builder:latest

rem Check if OPTS is defined, if not, set default value
if "%OPTS%"=="" (
set OPTS=-ti
)

rem Collect command-line arguments
set TARGETS=%*

rem If no arguments are provided, use "spec"
if "%TARGETS%"=="" (
set TARGETS=spec
)

rem Add parameters to TARGETS
set TARGETS=%TARGETS% SRC=Cpix.bs.md NAME=cpix

echo Running with targets: '%TARGETS%'
docker run --rm %OPTS% -v "%cd%:/data" -p 8000:8000 %IMG% %TARGETS%

29 changes: 29 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Here is the command that can be used to debug or develop with the
# local resources.
#
# docker run --rm -ti -v `pwd`:/data -v `pwd`/build-tools/tools:/tools -v `pwd`/data/boilerplate/dashif:/usr/local/lib/python3.12/dist-packages/bikeshed/spec-data/boilerplate/dashif dashif-specs:latest
#

# Run the docker container and pass all the arguments
IMG=dashif/specs-builder:latest

# Allow to overwrite additional options from the outside.
# We use tty and interactive by default since this makes it easier
# to deal with watch mode and Ctrl-C etc but we can not use this
# for instance in CI mode
if [ -z ${OPTS+x} ]; then
OPTS=-ti
fi

TARGETS="${@}"
if [ -z "${TARGETS}" ]; then
TARGETS="spec"
fi
# Add parameters
TARGETS="${TARGETS} SRC=Cpix.bs.md NAME=cpix"

echo "Run with targets: '${TARGETS}'"
docker run --rm ${OPTS} -v `pwd`:/data -p 8000:8000 \
${IMG} ${TARGETS}
2 changes: 2 additions & 0 deletions setup.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
docker pull dashif/specs-builder:latest
5 changes: 5 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

# Pull the latest build image
IMG=dashif/specs-builder:latest
docker pull ${IMG}

0 comments on commit 34aaf9e

Please sign in to comment.