Skip to content

Merge branch 'cms-monorepo' #2

Merge branch 'cms-monorepo'

Merge branch 'cms-monorepo' #2

Workflow file for this run

name: Deploy on Hosting
on:
push:
paths:
- apps/web/**
branches:
- main
- develop
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
environment:
name: ${{ endsWith(github.ref, '/main') && 'production' || 'development' }}
env:
PUBLIC_SITE_URL: "https://info.etherna.io"
PUBLIC_DIRECTUS_URL: "https://cms.etherna.io"
ANALYTICS_URL: "https://analytics.etherna.io"
ANALYTICS_SITE_ID: "1"
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
architecture: "x64"
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install
- name: Build site
run: pnpm build --filter web
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: "**/dist"
key: build-artifacts-${{ github.sha }}
publish_host:
name: Publish to Host
runs-on: ubuntu-latest
needs: build
environment:
name: production
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Restore build artifacts
uses: actions/cache@v4
with:
path: "**/dist"
key: build-artifacts-${{ github.sha }}
- name: Upload to Host
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.FTP_HOST }}
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
localDir: apps/web/dist
remoteDir: ${{ secrets.FTP_REMOTE_DIR }}
options: "--delete -X cgi-bin/ -X .well-known/"
publish_swarm:
name: Publish on Swarm
runs-on: ubuntu-latest
needs: build
environment:
name: production
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Restore build artifacts
uses: actions/cache@v4
with:
path: "**/dist"
key: build-artifacts-${{ github.sha }}
- name: Upload to swarm
uses: Etherna/swarm-upload-action@2.0.0
with:
gateway: https://gateway.etherna.io
localRoot: apps/web/dist
defaultPath: index.html
ethernaApiKey: ${{ secrets.ETHERNA_API_KEY }}
batchId: ${{ secrets.BATCH_ID }}
feedName: EthernaWebsite
feedType: epoch