60 lines
1.6 KiB
YAML
60 lines
1.6 KiB
YAML
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
depoly:
|
|
runs-on: fedora-40
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version-file: 'package.json'
|
|
|
|
- name: Cache Dependencies
|
|
id: dependencies-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.bun/install/cache
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Install Dependencies
|
|
run: bun install
|
|
|
|
- name: Build Dist (Staging)
|
|
run: bun dist -m staging
|
|
if: env.GITHUB_REF_NAME == 'master'
|
|
env:
|
|
VITE_CODE_VERSION: ${{ env.GITHUB_SHA }}
|
|
|
|
- name: Build Dist
|
|
run: bun dist
|
|
if: env.GITHUB_REF_NAME != 'master'
|
|
env:
|
|
VITE_CODE_VERSION: ${{ env.GITHUB_SHA }}
|
|
|
|
- name: Depoly to Preview
|
|
uses: https://github.com/cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
command: pages deploy --project-name=tututheapp dist
|
|
if: env.GITHUB_REF_NAME == 'master'
|
|
|
|
- name: Depoly to Production
|
|
uses: https://github.com/cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
command: pages deploy --project-name=tututheapp dist --branch=production
|
|
if: env.GITHUB_REF_NAME != 'master'
|
|
|