refactor(ci): local build #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v1 | |
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/[email protected] | |
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 |