Skip to content

Commit

Permalink
Workflow to push to cloudflare pages (#45)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikos Kontakis <[email protected]>
  • Loading branch information
Tbaut and wirednkod authored Aug 25, 2024
1 parent 8553c58 commit 2a7dd80
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 47 deletions.
22 changes: 5 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Build and Lint

on:
push:
Expand All @@ -9,26 +9,14 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
node-version: 21
# cache: 'pnpm'
# cache-dependency-path: 'pnpm-lock.yaml'
- run: pnpm install
- run: pnpm run build
- run: pnpm run lint

all:
# This job ensures that all jobs above (now we have just build) are successful.
needs: [build]
runs-on: ubuntu-latest
steps:
- run: echo Success
33 changes: 33 additions & 0 deletions .github/workflows/deploy-cf-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: UI deployment
on:
push:
branches: ['main']
# pull_request:
# branches: ['main']

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 21
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGE_GITHUB_API_TOKEN }}
accountId: ${{secrets.CLOUDFLARE_ACCOUNT_ID}}
projectName: delegit
directory: ./build
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
26 changes: 0 additions & 26 deletions .github/workflows/gh-publish.yml

This file was deleted.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"name": "dashboard",
"name": "delegit",
"private": true,
"version": "0.0.0",
"version": "0.0.1",
"type": "module",
"packageManager": "[email protected]",
"scripts": {
"preinstall": "npx only-allow pnpm",
"postinstall": "papi",
"dev": "vite",
"build": "tsc -b && vite build",
"deploy": "gh-pages -d build",
"build:pages": "tsc && vite build --base '/dashboard/'",
"deploy:pages": "pnpm run build:pages && gh-pages -d build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css}\""
Expand Down

0 comments on commit 2a7dd80

Please sign in to comment.