Apitalk #1125
Workflow file for this run
This file contains 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: | |
- cron: "1 2 3 * *" # run at 2 AM UTC once a week | |
workflow_dispatch: | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version-file: ".nvmrc" | |
- run: npm install | |
- run: npm run lint | |
indexpage: | |
name: Index Page | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version-file: ".nvmrc" | |
- run: npm install | |
- run: mkdir -p dist | |
- run: npm run build:indexhtml | |
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
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@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.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@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 | |
if: matrix.format == 'pdf' | |
with: | |
packages: ghostscript | |
version: 1.0 | |
- uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3 | |
with: | |
timeout_minutes: 10 | |
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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
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 |