Skip to content

Commit

Permalink
Add gh-pages (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
chevdor authored Jul 6, 2023
1 parent 120cc7b commit 839d50e
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 4 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Github Pages

on:
push:
branches: [ master ]
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

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

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

# Default to bash
defaults:
run:
shell: bash

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
YQ_VERSION: 4.30.4 # https://github.com/mikefarah/yq/releases
steps:
- name: Install Tools
run: |
wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_amd64
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Pages
id: pages
uses: actions/configure-pages@v2

- name: Render book
run: |
./scripts/build-json.sh
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./out

# Deployment job
deploy:
if: ${{ github.ref == 'refs/heads/master' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out
5 changes: 5 additions & 0 deletions scripts/build-json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

list="$(find assets -name "*.yaml" | tr "\n" " ")"
mkdir -p out
yq ea '[.]' $list | yq ea '[.]' | yq ea '{"assets": .[0]}' -o=json > out/assets.json
5 changes: 1 addition & 4 deletions scripts/build-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
# done

list="$(find assets -name "*.yaml" | tr "\n" " ")"

# echo "$list"

yq ea '[.]' $list | yq ea '[.]' | yq ea '{"assets": .[0]}' > /tmp/test.yaml
yq ea '[.]' "$list" | yq ea '[.]' | yq ea '{"assets": .[0]}' > /tmp/test.yaml

tera -t templates/list.md.tera /tmp/test.yaml > list.md

0 comments on commit 839d50e

Please sign in to comment.