Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisns committed Oct 18, 2023
1 parent 31a2096 commit 3b801ce
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 22 deletions.
143 changes: 123 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
workflow_dispatch:

jobs:
build:
checkout:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get update
Expand All @@ -25,34 +25,137 @@ jobs:
node-version-file: ".nvmrc"

- run: npm install
- run: npm run lint
- run: npm run build

- name: Tar files
run: tar -cf dist.tar ./dist
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: dist.tar
name: index.tar
path: dist.tar

publish:
images:
name: Images
needs: checkout
runs-on: ubuntu-latest
environment:
name: production
url: https://talks.cns.me
permissions:
id-token: write
needs:
- build
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
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:
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
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: generatematrix
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
7 changes: 7 additions & 0 deletions .marprc-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
allowLocalFiles: true
options:
minifyCSS: false
themeSet: "themes/cns.css"
bespoke:
progress: true
html: true
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build:html": "marp",
"build:pptx": "marp --pptx",
"build:image": "marp --image",
"build:notes": "marp --notes",
"build:txt": "marp --notes",
"build:pdf": "marp --pdf --pdf-notes && ./compress_pdfs.sh",
"build:images": "cp -vr images dist/",
"build:indexhtml": "node generate_index.js > dist/index.html",
Expand All @@ -36,4 +36,4 @@
"postcss-use": "^3.0.0",
"prettier": "3.0.3"
}
}
}

0 comments on commit 3b801ce

Please sign in to comment.