feat: New shortpost - frontend environment diversity #414
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: Deploy Pipeline | |
on: [push] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} | |
YOUTUBEAPIKEY: ${{ secrets.YOUTUBEAPIKEY }} | |
PUBLIC_GOOGLEANALYTIC_ID: ${{ vars.PUBLIC_GOOGLEANALYTIC_ID }} | |
permissions: | |
contents: read | |
deployments: write | |
name: Deploy to Cloudflare Pages | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
run_install: false | |
- name: Create LFS file list | |
run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id | |
- name: LFS Cache | |
uses: actions/cache@v3 | |
with: | |
path: .git/lfs/objects | |
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
restore-keys: | | |
${{ runner.os }}-lfs- | |
- name: Git LFS Pull | |
run: git lfs pull | |
- name: Build for Production (main) branch | |
if: github.ref == 'refs/heads/main' | |
run: | | |
pnpm install --frozen-lockfile | |
pnpm build | |
- name: Build for Non-production (other) branch | |
if: github.ref != 'refs/heads/main' | |
uses: cypress-io/github-action@v6 | |
with: | |
build: pnpm build:staging | |
start: pnpm preview | |
- name: Lint | |
run: pnpm lint | |
- name: Typecheck | |
run: pnpm typecheck | |
- name: Lighthouse | |
run: pnpm lhci autorun | |
- name: Publish | |
uses: cloudflare/pages-action@1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: astro-blog | |
directory: dist | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} |