-
-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·153 lines (139 loc) · 4.52 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
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
- pdf
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