Fix stats script for efficiency #1296
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
# Runs monthly on the 3rd day at 02:01 UTC | |
- cron: "1 2 3 * *" | |
workflow_dispatch: | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
with: | |
node-version-file: ".nvmrc" | |
- run: npm install | |
- run: npm run lint | |
- run: npm test | |
indexpage: | |
name: Index Page | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
with: | |
node-version-file: ".nvmrc" | |
- run: npm install | |
- run: mkdir -p dist | |
- run: npm run build:indexhtml | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: index | |
path: dist/index.html | |
retention-days: 1 | |
generate-matrix: | |
name: Generate Matrix Build | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
sparse-checkout: . | |
- id: set-matrix | |
run: echo "matrix=$(ls *.md | sed -e 's/.md//g' | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- generate-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
file: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
format: | |
- html | |
- pptx | |
- image | |
- txt | |
exclude: | |
- file: CODE_OF_CONDUCT | |
- file: README | |
- file: schedule | |
- file: SECURITY | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
with: | |
node-version-file: ".nvmrc" | |
- run: find . -name "*.md" ! -name "${{ matrix.file }}.md" -exec rm {} + | |
- run: npm install | |
- run: npm run build:css | |
if: matrix.format != 'txt' | |
- uses: awalsh128/cache-apt-pkgs-action@5902b33ae29014e6ca012c5d8025d4346556bd40 # v1.4.3 | |
if: matrix.format == 'pdf' | |
with: | |
packages: ghostscript | |
version: 1.0 | |
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 | |
with: | |
timeout_minutes: 30 | |
max_attempts: 3 | |
command: PUPPETEER_TIMEOUT=1200000 npm run build:${{ matrix.format }} | |
- run: mv -v dist/*.* ${{ matrix.file }}.${{ matrix.format }} | |
- run: npm run build:pdf:compress | |
if: matrix.format == 'pdf' | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: ${{ matrix.file }}-${{ matrix.format }} | |
path: ${{ matrix.file }}.${{ matrix.format }} | |
retention-days: 1 | |
converge: | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- build | |
- indexpage | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
sparse-checkout: images | |
- run: mkdir -p dist | |
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
with: | |
path: artifacts/ | |
- run: mv -v artifacts/*/* dist/ | |
- run: for file in dist/*.image; do mv "$file" "${file%.image}.png"; done | |
- run: cp -vr images dist/ | |
- run: tar -cvf dist.tar ./dist | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: dist.tar | |
path: dist.tar | |
retention-days: 1 | |
publish: | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: https://talks.cns.me | |
permissions: | |
id-token: write | |
needs: | |
- converge | |
if: ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
with: | |
name: dist.tar | |
- run: tar -xf dist.tar | |
- uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # 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 |