From 3b801ce6179d1c43fab6d25d6357f2ad9a232d74 Mon Sep 17 00:00:00 2001 From: Chris Nesbitt-Smith Date: Wed, 18 Oct 2023 15:08:29 +0100 Subject: [PATCH] try --- .github/workflows/ci.yaml | 143 ++++++++++++++++++++++++++++++++------ .marprc-build.yml | 7 ++ package.json | 4 +- 3 files changed, 132 insertions(+), 22 deletions(-) create mode 100755 .marprc-build.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index be8deefc0..f8de5ae8b 100755 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ on: workflow_dispatch: jobs: - build: + checkout: runs-on: ubuntu-latest steps: - run: sudo apt-get update @@ -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 diff --git a/.marprc-build.yml b/.marprc-build.yml new file mode 100755 index 000000000..bad29fd21 --- /dev/null +++ b/.marprc-build.yml @@ -0,0 +1,7 @@ +allowLocalFiles: true +options: + minifyCSS: false + themeSet: "themes/cns.css" +bespoke: + progress: true +html: true diff --git a/package.json b/package.json index eca549fe1..a556d5c65 100755 --- a/package.json +++ b/package.json @@ -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", @@ -36,4 +36,4 @@ "postcss-use": "^3.0.0", "prettier": "3.0.3" } -} +} \ No newline at end of file