Skip to content

Commit 0ca0843

Browse files
committed
ci: change project to github actions based workflow
1 parent f153653 commit 0ca0843

File tree

9 files changed

+70
-192
lines changed

9 files changed

+70
-192
lines changed

.github/workflows/deploy.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish
2+
3+
on:
4+
# Runs on pushes targeting the default branch
5+
push:
6+
branches: ["main"]
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
12+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Use Node.js 20.x
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: 20.x
28+
cache: 'npm'
29+
cache-dependency-path: '**/package-lock.json'
30+
31+
- name: Install Node.js app dependencies
32+
run: npm ci
33+
working-directory: ./scripts/doc-processor
34+
35+
- name: Process documentations & assets
36+
run: node scripts/doc-processor/cli.js
37+
38+
- name: Setup Pages
39+
uses: actions/configure-pages@v4
40+
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
# Upload the "public" directory
45+
path: 'public'
46+
deploy:
47+
needs: build
48+
49+
permissions:
50+
pages: write # to deploy to Pages
51+
id-token: write # to verify the deployment originates from an appropriate source
52+
53+
# Deploy to the github-pages environment
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Deploy to GitHub Pages
61+
id: deployment
62+
uses: actions/deploy-pages@v4
63+

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
public/*.html
3+
public/*.css

docs/index.html

-26
This file was deleted.

docs/style-8123f0b.css

-160
This file was deleted.
File renamed without changes.

docs-raw/style.css pages/style.css

File renamed without changes.

docs/CNAME public/CNAME

File renamed without changes.

scripts/doc-processor/README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
_Why add content to your website, when you can spend an afternoon doing this instead!_
44

5-
For now, this applies basic formatting to a given HTML file, and also cache-busts its css. Later though, if the site
6-
expands to multiple pages, it'll likely do more.
5+
This primarily exists to ensure that assets are permanently cachable in a way that's revokable.
76

87
### Usage
98

10-
To format a given file in-situ, run the following:
9+
To process all the HTML files in a directory and output them to a different one, run:
1110

1211
```sh
13-
node cli.js path/to/file.html
12+
node cli.js -i path/to/input/dir -o path/to/output/dir
1413
```

scripts/doc-processor/cli.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const {
1818
'input-dir': {
1919
type: 'string',
2020
short: 'i',
21-
default: path.resolve(__dirname, '..', '..', 'docs-raw')
21+
default: path.resolve(__dirname, '..', '..', 'pages')
2222
},
2323
'output-dir': {
2424
type: 'string',
2525
short: 'o',
26-
default: path.resolve(__dirname, '..', '..', 'docs')
26+
default: path.resolve(__dirname, '..', '..', 'public')
2727
}
2828
}
2929
});

0 commit comments

Comments
 (0)