Skip to content

Commit

Permalink
ci: migrated to Cloudflare Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-pogor committed Dec 23, 2024
1 parent 4bc1c7f commit 9be405d
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 100 deletions.
55 changes: 0 additions & 55 deletions .github/workflows/astro.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "⚙️ Build and Upload Artifact Reusable Workflow"
on:
workflow_call: # Reusable workflow
inputs:
upload_artifact:
type: boolean
required: false
description: "Whether to upload build artifact. Used in the deploy job."
jobs:
build:
name: "⚙️ Build"
runs-on: ubuntu-latest
timeout-minutes: 3
permissions:
contents: read
env:
NODE_VERSION: 18.x
steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: "🔧 Setup pnpm"
with:
version: 8
run_install: false
- name: "🔧 Setup Node.js ${{ env.NODE_VERSION }}"
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: "📦 Install dependencies"
run: pnpm install
- name: "🔎 Lint code"
run: pnpm run lint
- name: "📝 Checking code format"
run: pnpm run format:check
- name: "⚙️ Build the project"
run: pnpm run build
- name: "📦 Upload build artifact"
if: ${{ inputs.upload_artifact }}
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: ./dist
50 changes: 5 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,9 @@
name: CI

name: "⚙️ PR Build"
on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened
workflow_call:

jobs:
build:
name: Code standards & build
runs-on: ubuntu-latest
timeout-minutes: 3

strategy:
matrix:
node-version: [18.x]

steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: "🔧 Setup pnpm"
with:
version: 8
run_install: false

- name: "🔧 Setup Node.js ${{ matrix.node-version }}"
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: "📦 Install dependencies"
run: pnpm install

- name: "🔎 Lint code"
run: pnpm run lint

- name: "📝 Checking code format"
run: pnpm run format:check

- name: "🚀 Build the project"
run: pnpm run build
name: "⚙️ Build"
uses: ./.github/workflows/build.yml
with:
upload_artifact: false
33 changes: 33 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "🚀 Deploy to Cloudflare Pages"
on:
push:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
name: "⚙️ Build"
uses: ./.github/workflows/build.yml
with:
upload_artifact: true
deploy:
name: "🚀 Deploy to Cloudflare Pages"
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
deployments: write
steps:
- name: "☁️ Download build artifact"
uses: actions/download-artifact@v4
with:
name: build-artifact
- name: "🚀 Publish"
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: pogor-dev
directory: ./
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 9be405d

Please sign in to comment.