github: Publish pages

This commit is contained in:
Remko Tronçon 2023-03-18 09:30:15 +01:00
parent f9a07b2bcf
commit 7ccc11dd41
11 changed files with 67 additions and 77 deletions

46
.github/workflows/build-master.yml vendored Normal file
View file

@ -0,0 +1,46 @@
name: Build (master)
on:
workflow_dispatch:
push:
branches: [master]
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
uses: ./.github/workflows/build.yml
deploy-pages:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
deploy-aws:
needs: build
runs-on: ubuntu-latest
steps:
- run: sudo apt-get update
- run: sudo apt-get install awscli
- uses: actions/download-artifact@v2
with:
name: github-pages
- run: |
mkdir pages
tar xf artifact.tar -C pages
- run: ls -R pages
- name: aws s3 sync
run: |
aws configure set region eu-central-1
aws configure set aws_access_key_id ${{secrets.AWS_ACCESS_KEY_ID}}
aws configure set aws_secret_access_key ${{secrets.AWS_SECRET_ACCESS_KEY}}
aws s3 sync pages/ s3://${{secrets.AWS_SITE_BUCKET}}/waforth/

View file

@ -13,7 +13,7 @@ jobs:
os: [macos-latest, ubuntu-18.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: make -C src/standalone install-deps package
- run: make -C src/standalone check

View file

@ -10,6 +10,6 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: make -C src/web/vscode-extension install-deps package

View file

@ -13,7 +13,7 @@ jobs:
os: [macos-latest, ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- if: runner.os == 'macOS' || runner.os == 'Windows'

View file

@ -2,6 +2,7 @@ name: Build
on:
push:
branches: ['*', '!master']
pull_request:
workflow_dispatch:
workflow_call:
@ -10,9 +11,19 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: yarnpkg build
- run: make -C src/web/notebook
- run: yarnpkg lint
- run: yarnpkg test --coverage
- run: make -C src/web/notebook
- run: ./dist/wafnb2html src/web/notebook/examples/drawing-with-forth.wafnb
# Build & upload pages
- run: |
mkdir -p public/waforth/drawing-with-forth
cp src/web/notebook/examples/drawing-with-forth.html public/waforth/drawing-with-forth/index.html
shell: bash
- uses: actions/upload-pages-artifact@v1
with:
path: public/waforth

View file

@ -1,25 +0,0 @@
name: Publish Notebook
on:
workflow_dispatch:
jobs:
build:
uses: ./.github/workflows/build.yml
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
- run: sudo apt-get update
- run: sudo apt-get install awscli
- run: make -C src/web/notebook
- run: ./dist/wafnb2html src/web/notebook/examples/drawing-with-forth.wafnb
- name: aws s3 sync
run: |
aws configure set region eu-central-1
aws configure set aws_access_key_id ${{secrets.AWS_ACCESS_KEY_ID}}
aws configure set aws_secret_access_key ${{secrets.AWS_SECRET_ACCESS_KEY}}
aws s3 cp src/web/notebook/examples/drawing-with-forth.html s3://${{secrets.AWS_SITE_BUCKET}}/wafnb/drawing-with-forth/index.html

View file

@ -12,24 +12,8 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: yarnpkg publish --non-interactive
env:
NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
publish-site:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
- run: sudo apt-get update
- run: sudo apt-get install awscli
- run: yarnpkg build
- name: aws s3 sync
run: |
aws configure set region eu-central-1
aws configure set aws_access_key_id ${{secrets.AWS_ACCESS_KEY_ID}}
aws configure set aws_secret_access_key ${{secrets.AWS_SECRET_ACCESS_KEY}}
aws s3 sync public/waforth/ s3://${{secrets.AWS_SITE_BUCKET}}/waforth/

View file

@ -15,7 +15,7 @@ jobs:
os: [macos-latest, ubuntu-18.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: make -C src/standalone install-deps package
- run: make -C src/standalone check

View file

@ -1,26 +0,0 @@
name: Publish Thurtle
on:
workflow_dispatch:
jobs:
build:
uses: ./.github/workflows/build.yml
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
- run: sudo apt-get update
- run: sudo apt-get install awscli
- run: yarnpkg build
- name: aws s3 sync
run: |
aws configure set region eu-central-1
aws configure set aws_access_key_id ${{secrets.AWS_ACCESS_KEY_ID}}
aws configure set aws_secret_access_key ${{secrets.AWS_SECRET_ACCESS_KEY}}
aws s3 sync public/thurtle/ s3://${{secrets.AWS_SITE_BUCKET}}/thurtle/
aws s3 sync public/waforth/dist/ s3://${{secrets.AWS_SITE_BUCKET}}/waforth/dist/ --exclude "*" --include "thurtle-*" --include "logo-*.svg" --include "turtle-*.svg"

View file

@ -15,7 +15,7 @@ jobs:
os: [macos-latest, ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- if: runner.os == 'macOS' || runner.os == 'Windows'

View file

@ -98,7 +98,7 @@ async function handleBuildFinished(result) {
["WAForh Benchmarks", "benchmarks", "public/waforth/benchmarks"],
["WAForth Prompt Example", "prompt", "public/waforth/examples/prompt"],
["WAForth Fetch Example", "fetch", "public/waforth/examples/fetch"],
["Thurtle", "thurtle", "public/thurtle", true],
["Thurtle", "thurtle", "public/waforth/thurtle", true],
];
for (const [title, base, outpath, bs] of indexes) {
let index = INDEX_TEMPLATE.replace(/\$BASE/g, base).replace(