56 lines
1.5 KiB
YAML
56 lines
1.5 KiB
YAML
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
depoly:
|
|
runs-on: fedora-41
|
|
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: VITE_CODE_VERSION=$GITHUB_SHA bun dist -m staging
|
|
if: env.GITHUB_REF_NAME == 'master'
|
|
|
|
- name: Build Dist
|
|
run: VITE_CODE_VERSION=$GITHUB_SHA bun dist
|
|
if: env.GITHUB_REF_NAME != 'master'
|
|
|
|
- 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'
|
|
|