Skip to content

parallel builds

parallel builds #615

Workflow file for this run

name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
pull_request:
schedule:
- cron: "1 2 3 * *" # run at 2 AM UTC once a week
workflow_dispatch:
jobs:
checkout:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get update
- run: sudo apt-get -y install ghostscript
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: ".nvmrc"
- run: npm install
- run: npm run build
- name: Tar files
run: tar -cf checkout.tar ./
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: checkout.tar
path: checkout.tar
lint:
name: Lint
needs: checkout
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: ".nvmrc"
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: checkout.tar
- run: tar -xf checkout.tar ./
- run: npm run lint
indexpage:
name: Index Page
needs: checkout
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: ".nvmrc"
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: checkout.tar
- run: tar -xf checkout.tar ./
- run: npm run build:indexhtml
- run: tar -cf dist.tar ./dist
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: index.tar
path: dist.tar
images:
name: Images
needs: checkout
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: checkout.tar
- run: tar -xf checkout.tar ./
- run: cp -vr images dist/
- run: tar -cf dist.tar ./dist
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: images.tar
path: dist.tar
generate-matrix:
name: Generate Matrix Build
needs: checkout
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: checkout.tar
- run: echo "::set-output name=matrix::$(ls *.md | jq -R -s -c 'split("\n")[:-1]')"
build:
runs-on: ubuntu-latest
needs:
- generate-matrix
strategy:
matrix:
file: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
format:
- html
# - pttx
# - image
- txt
# - pdf
steps:
- run: sudo apt-get update
- run: sudo apt-get -y install ghostscript
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: ".nvmrc"
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: checkout.tar
- run: tar -xf checkout.tar ./
- run: npm install
- run: npm run build:${{ matrix.format }} -- -c .marprc-build.yml ${{ matrix.file }} -o ./dist/$(echo ${{ matrix.file }} | sed s/.md/.${{ matrix.format }}/)
if: matrix.format != 'image'
- run: tar -cf dist.tar ./dist
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: ${{ matrix.file }}-${{ matrix.format }}.tar
path: dist.tar
converge:
runs-on: ubuntu-latest
needs:
- build
- indexpage
- images
steps:
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- run: ls
# publish:
# runs-on: ubuntu-latest
# environment:
# name: production
# url: https://talks.cns.me
# permissions:
# id-token: write
# needs:
# - build
# - lint
# if: ${{ github.ref == 'refs/heads/main' }}
# steps:
# - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
# with:
# name: dist.tar
# - run: tar -xf dist.tar
# - uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4
# with:
# role-to-assume: arn:aws:iam::557195821817:role/talks-cns-me-write
# aws-region: eu-west-2
# - run: aws s3 sync --delete dist s3://talks.cns.me