Skip to content

Build and deploy page via CI #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Ref: https://github.com/actions/starter-workflows/tree/main/pages
# Ref: https://stackoverflow.com/questions/65370859/github-action-trigger-on-another-repo-update-push-pull-request/65514259#65514259

on:
# When accepting PRs
push:
branches:
- 'main'

# Allow running workflow manually
workflow_dispatch:

# Allow labwc main repo to trigger the action
repository_dispatch:
types:
- rebuild

jobs:

build:
runs-on: ubuntu-latest

steps:
- name: Prepare
run: sudo apt update && sudo apt install -y scdoc pandoc

- name: Checkout labwc.github.io
uses: actions/checkout@v3

- name: Checkout labwc
uses: actions/checkout@v3
with:
repository: 'labwc/labwc'
path: 'labwc'

- name: Build page
run: ./build-site

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'deploy'

deploy:
needs: build

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v1
97 changes: 97 additions & 0 deletions .github/workflows/irc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: "IRC Notifications"
on:
create:
pull_request:
types: [opened, closed, reopened]
issues:
types: [opened, closed, reopened]
push:
branches:
- 'master_disabled'
- 'v0.5_disabled'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: irc push
uses: rectalogic/notify-irc@v1
if: github.event_name == 'push'
with:
server: "irc.libera.chat"
channel: "#labwc"
nickname: "labwc"
notice: true
message: "[${{ github.event.ref }}] ${{ github.actor }} pushed new commits: ${{ github.event.compare }}"
- name: irc issue opened
uses: rectalogic/notify-irc@v1
if: github.event_name == 'issues' && github.event.action == 'opened'
with:
server: "irc.libera.chat"
channel: "#labwc"
nickname: "labwc"
notice: true
message: "${{ github.actor }} opened issue '${{ github.event.issue.title }}' (${{ github.event.issue.html_url }})"
- name: irc issue reopened
uses: rectalogic/notify-irc@v1
if: github.event_name == 'issues' && github.event.action == 'reopened'
with:
server: "irc.libera.chat"
channel: "#labwc"
nickname: "labwc"
notice: true
message: "${{ github.actor }} reopened issue: '${{ github.event.issue.title }}' (${{ github.event.issue.html_url }})"
- name: irc issue closed
uses: rectalogic/notify-irc@v1
if: github.event_name == 'issues' && github.event.action == 'closed'
with:
server: "irc.libera.chat"
channel: "#labwc"
nickname: "labwc"
notice: true
message: "${{ github.actor }} closed issue '${{ github.event.issue.title }}' (${{ github.event.issue.html_url }})"
- name: irc pull request opened
uses: rectalogic/notify-irc@v1
if: github.event_name == 'pull_request' && github.event.action == 'opened'
with:
server: "irc.libera.chat"
channel: "#labwc"
nickname: "labwc"
notice: true
message: "[${{ github.event.pull_request.base.ref }}] ${{ github.actor }} opened PR '${{ github.event.pull_request.title }}' (${{ github.event.pull_request.html_url }})"
- name: irc pull request reopened
uses: rectalogic/notify-irc@v1
if: github.event_name == 'pull_request' && github.event.action == 'reopened'
with:
server: "irc.libera.chat"
channel: "#labwc"
nickname: "labwc"
notice: true
message: "[${{ github.event.pull_request.base.ref }}] ${{ github.actor }} reopened PR '${{ github.event.pull_request.title }}' (${{ github.event.pull_request.html_url }})"
- name: irc pull request merged
uses: rectalogic/notify-irc@v1
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
with:
server: "irc.libera.chat"
channel: "#labwc"
nickname: "labwc"
notice: true
message: "[${{ github.event.pull_request.base.ref }}] ${{ github.actor }} merged PR '${{ github.event.pull_request.title }}' (${{ github.event.pull_request.html_url }})"
- name: irc pull request closed
uses: rectalogic/notify-irc@v1
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == false
with:
server: "irc.libera.chat"
channel: "#labwc"
nickname: "labwc"
notice: true
message: "[${{ github.event.pull_request.base.ref }}] ${{ github.actor }} closed PR '${{ github.event.pull_request.title }}' (${{ github.event.pull_request.html_url }})"
- name: irc tag created
uses: rectalogic/notify-irc@v1
if: github.event_name == 'create' && github.event.ref_type == 'tag'
with:
server: "irc.libera.chat"
channel: "#labwc"
nickname: "labwc"
notice: true
message: "${{ github.actor }} tagged ${{ github.repository }}: ${{ github.event.ref }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
labwc/
deploy/*.html
48 changes: 21 additions & 27 deletions build-site
Original file line number Diff line number Diff line change
@@ -1,46 +1,40 @@
#!/usr/bin/env bash
#
# This script depends on pandoc
#

: ${LABWC_DOC_DIR:=../labwc/build/docs}

die () {
printf 'fatal: %b\n' "$@" >&2
exit 1
}
: ${DEPLOY_DIR:=deploy}

build_src_pages () {
template="$(<"src/template.html")"
for md in src/*.md; do
filename=${md##*/}
html="${filename/%.md/.html}"
[[ $html -ot $md ]] || continue
printf '%s\n' " GEN ${html}"
printf '%b' "${template/'{{content}}'/$(pandoc --from=markdown+footnotes "$md")}" >"${html}"
html=${md##*/}
html="${DEPLOY_DIR}/${html/%.md/.html}"
echo "Converting $md to $html"

cat src/template_pre.html > "$html"
pandoc --from=markdown+footnotes "$md" >> "$html"
cat src/template_post.html >> "$html"
done
}

build_man_pages () {
if ! [[ -d "$LABWC_DOC_DIR" ]]; then
printf 'warn: %b\n' "Need labwc next to labwc.github.io with man pages built" >&2
return
fi
template="$(sed -e 's/sans-serif;/monospace;/' src/template.html)"
for scd in "$LABWC_DOC_DIR"/*; do
filename=${scd##*/}
html=$(basename ${scd}).html
[[ $html -ot $scd ]] || continue
printf '%s\n' " GEN ${html}"
printf '%b' "${template/'{{content}}'/$(pandoc --from man "$scd")}" >"${html}"
./fix-bullet-formatting.py "${html}"
test -d labwc || git clone --branch master --depth 1 https://github.com/labwc/labwc labwc

for scd in labwc/docs/*.scd; do
html=${scd##*/}
html="${DEPLOY_DIR}/${html/%.scd/.html}"
echo "Converting $scd to $html"

sed 's/sans-serif;/monospace;/' src/template_pre.html > "$html"
scdoc < "$scd" | pandoc --from man >> "$html"
cat src/template_post.html >> "$html"
./fix-bullet-formatting.py "$html"
done
}

main () {
mkdir -p "$DEPLOY_DIR"

build_src_pages
build_man_pages
}

main "$@"

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
135 changes: 0 additions & 135 deletions diagrams-theme.html

This file was deleted.

Loading