Skip to content

Commit cec24fe

Browse files
authored
Merge pull request #493 from ipfs/local-CAR-build
refactor(ci): local build
2 parents 0e5c2f7 + 5f5bf93 commit cec24fe

File tree

5 files changed

+11293
-11
lines changed

5 files changed

+11293
-11
lines changed

.github/workflows/build.yml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Build and Deploy
2+
3+
# Explicitly declare permissions
4+
permissions:
5+
contents: read
6+
pull-requests: write
7+
statuses: write
8+
9+
on:
10+
push:
11+
branches:
12+
- main
13+
pull_request:
14+
branches:
15+
- main
16+
17+
env:
18+
BUILD_PATH: 'out'
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true # Cancel in progress runs if a new run is started
23+
24+
jobs:
25+
build-and-deploy:
26+
runs-on: ubuntu-latest
27+
outputs:
28+
cid: ${{ steps.deploy.outputs.cid }}
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: '20'
37+
cache: 'npm'
38+
39+
- name: Install dependencies
40+
run: npm ci --prefer-offline --no-audit --progress=false
41+
42+
- name: Build project
43+
run: make website
44+
45+
- name: Upload static files as artifact
46+
id: upload-artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: ${{ env.BUILD_PATH }}
50+
51+
- uses: ipfs/ipfs-deploy-action@v1
52+
name: Deploy to IPFS Mirror Providers
53+
id: deploy
54+
with:
55+
path-to-deploy: ${{ env.BUILD_PATH }}
56+
cluster-url: "/dnsaddr/ipfs-websites.collab.ipfscluster.io"
57+
cluster-user: ${{ secrets.CLUSTER_USER }}
58+
cluster-password: ${{ secrets.CLUSTER_PASSWORD }}
59+
storacha-key: ${{ secrets.STORACHA_KEY }}
60+
storacha-proof: ${{ secrets.STORACHA_PROOF }}
61+
#TODO pinata-jwt-token: ${{ secrets.PINATA_JWT_TOKEN }}
62+
github-token: ${{ github.token }}
63+
64+
# TODO: right now, DNSLink is controlled by Fleek, and we use ipfs/ipfs-deploy-action for PR previews
65+
#- name: Update DNSLink
66+
# if: false # TODO github.ref == 'refs/heads/main' # only update DNSLink for main branch
67+
# uses: ipfs/[email protected]
68+
# with:
69+
# cid: ${{ steps.deploy.outputs.cid }}
70+
# dnslink_domain: 'specs.ipfs.tech'
71+
# cf_record_id: ${{ secrets.CF_RECORD_ID }}
72+
# cf_zone_id: ${{ secrets.CF_ZONE_ID }}
73+
# cf_auth_token: ${{ secrets.CF_AUTH_TOKEN }}
74+
# github_token: ${{ github.token }}
75+
# set_github_status: true
76+
77+
78+
gh-pages:
79+
runs-on: 'ubuntu-latest'
80+
needs: build-and-deploy
81+
if: github.ref == 'refs/heads/main' # only deploy to gh-pages for main branch
82+
permissions:
83+
pages: write # to deploy to Pages
84+
id-token: write # to verify the deployment originates from an appropriate source
85+
environment:
86+
name: 'github-pages'
87+
url: ${{ steps.deployment.outputs.page_url }}
88+
steps:
89+
- name: Deploy to GitHub Pages
90+
id: deployment
91+
uses: actions/deploy-pages@v4

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
out/
2+
node_modules/
23
super-linter.log

Makefile

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
SPEC_GENERATOR_VER=1.5.0
2-
31
.PHONY: install
42

53
all: website
@@ -8,20 +6,15 @@ clean:
86
rm -rf ./out
97

108
install:
11-
@INSTALLED_VERSION=$$(spec-generator --version); \
12-
if [ "$$INSTALLED_VERSION" != "$(SPEC_GENERATOR_VER)" ]; then \
13-
echo "Installed version ($$INSTALLED_VERSION) is different from the desired version ($(SPEC_GENERATOR_VER))."; \
14-
echo "Installing spec-generator@v$(SPEC_GENERATOR_VER)"; \
15-
npm install -g spec-generator@v$(SPEC_GENERATOR_VER); \
16-
else \
17-
echo "spec-generator is already installed at the desired version ($(SPEC_GENERATOR_VER))."; \
9+
@if [ ! -d "node_modules" ] || ! git diff --quiet package-lock.json; then \
10+
npm ci --prefer-offline --no-audit --no-fund --progress=false; \
1811
fi
1912

2013
website: clean install
21-
spec-generator -c .config.json
14+
npx spec-generator -c .config.json
2215

2316
watch: clean install
24-
spec-generator -c .config.json -w
17+
npx spec-generator -c .config.json -w
2518

2619
superlinter:
2720
docker run --rm -e VALIDATE_ALL_CODEBASE=false -e RUN_LOCAL=true -e VALIDATE_MARKDOWN=true -e MARKDOWN_CONFIG_FILE=".markdownlint.json" -e LINTER_RULES_PATH="." -e DEFAULT_BRANCH='main' -v $(shell pwd):/tmp/lint ghcr.io/super-linter/super-linter:slim-v7

0 commit comments

Comments
 (0)