Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build and Deploy

# Explicitly declare permissions
permissions:
contents: read
pull-requests: write
statuses: write

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
BUILD_PATH: 'out'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true # Cancel in progress runs if a new run is started

jobs:
build-and-deploy:
runs-on: ubuntu-latest
outputs:
cid: ${{ steps.deploy.outputs.cid }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci --prefer-offline --no-audit --progress=false

- name: Build project
run: make website

- name: Upload static files as artifact
id: upload-artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.BUILD_PATH }}

- uses: ipfs/ipfs-deploy-action@6b8f42e9e539bc5ab0624183eb31cd0383e59f5c
name: Deploy to IPFS Mirror Providers
id: deploy
with:
path-to-deploy: ${{ env.BUILD_PATH }}
cluster-url: "/dnsaddr/ipfs-websites.collab.ipfscluster.io"
cluster-user: ${{ secrets.CLUSTER_USER }}
cluster-password: ${{ secrets.CLUSTER_PASSWORD }}
storacha-key: ${{ secrets.STORACHA_KEY }}
storacha-proof: ${{ secrets.STORACHA_PROOF }}
#TODO pinata-jwt-token: ${{ secrets.PINATA_JWT_TOKEN }}
github-token: ${{ github.token }}

- name: Update DNSLink
if: false # TODO github.ref == 'refs/heads/main' # only update DNSLink for main branch
uses: ipfs/dnslink-action@v0.1
with:
cid: ${{ steps.deploy.outputs.cid }}
dnslink_domain: 'specs.ipfs.tech'
cf_record_id: ${{ secrets.CF_RECORD_ID }}
cf_zone_id: ${{ secrets.CF_ZONE_ID }}
cf_auth_token: ${{ secrets.CF_AUTH_TOKEN }}
github_token: ${{ github.token }}
set_github_status: true


gh-pages:
runs-on: 'ubuntu-latest'
needs: build-and-deploy
if: github.ref == 'refs/heads/main' # only deploy to gh-pages for main branch
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: 'github-pages'
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
out/
node_modules/
super-linter.log
15 changes: 4 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
SPEC_GENERATOR_VER=1.5.0

.PHONY: install

all: website
Expand All @@ -8,20 +6,15 @@ clean:
rm -rf ./out

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

website: clean install
spec-generator -c .config.json
npx spec-generator -c .config.json

watch: clean install
spec-generator -c .config.json -w
npx spec-generator -c .config.json -w

superlinter:
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
Loading