forked from FabricMC/fabricmc.net
-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (84 loc) · 2.6 KB
/
build.yml
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
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-22.04
env:
ImageOS: ubuntu22
steps:
- uses: actions/checkout@v4
# Maintain timestamps of previously published files
- uses: actions/checkout@v4
with:
ref: static
path: _site
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.4'
- uses: denoland/setup-deno@v1
with:
deno-version: "1.34.0"
# Jekyll 4 fails to create the .jekyll-cache directory, but if we pre-create it, it works
- run: mkdir -p .jekyll-cache
- run: bundler install --deployment && bundler exec jekyll build
- run: npm i
working-directory: ./scripts
- run: npm run check
working-directory: ./scripts
- run: npm run build
working-directory: ./scripts
- run: npm run buildLib
working-directory: ./scripts
- run: make build
working-directory: ./cli
- run: rm -rf ./_site/cli && cp ./cli/bundled.ts ./_site/cli
# Upload the static content as a workflow artifact when not publishing the site (non-main branches)
- name: Archive site
uses: actions/upload-artifact@v4
with:
name: site
path: _site
retention-days: 2
# Separate job so it doesn't run inside the jekyll container
publish:
needs: build
runs-on: ubuntu-22.04
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
steps:
- uses: actions/download-artifact@v4
with:
name: site
path: _site
# Publish to GH pages on main branch
- name: Push to GH pages
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: static
FOLDER: _site
CLEAN: true
build-api:
runs-on: ubuntu-22.04
env:
ImageOS: ubuntu22
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm i
working-directory: ./scripts
- run: npm i
working-directory: ./template-api
- run: npm run buildLib
working-directory: ./scripts
- run: npm run build
working-directory: ./template-api
- uses: cloudflare/wrangler-action@v3
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: "template-api"