2024-07-14 12:58:55 +00:00
|
|
|
|
2024-07-14 14:05:12 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
tags:
|
|
|
|
- "v*"
|
2024-07-14 12:58:55 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
depoly:
|
2024-07-14 13:18:28 +00:00
|
|
|
runs-on: fedora-40
|
2024-07-14 12:58:55 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
2024-08-05 06:12:33 +00:00
|
|
|
- name: Setup Bun
|
|
|
|
uses: oven-sh/setup-bun@v2
|
|
|
|
with:
|
|
|
|
bun-version-file: 'package.json'
|
2024-07-14 12:58:55 +00:00
|
|
|
|
|
|
|
- name: Cache Dependencies
|
|
|
|
id: dependencies-cache
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
2024-08-05 06:12:33 +00:00
|
|
|
path: ~/.bun/install/cache
|
|
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-bun-
|
2024-07-14 12:58:55 +00:00
|
|
|
|
|
|
|
- name: Install Dependencies
|
2024-08-05 06:12:33 +00:00
|
|
|
run: bun install
|
2024-07-14 12:58:55 +00:00
|
|
|
|
2024-07-22 13:59:37 +00:00
|
|
|
- name: Build Dist (Staging)
|
2024-11-11 07:06:48 +00:00
|
|
|
run: VITE_CODE_VERSION=$GITHUB_SHA bun dist -m staging
|
2024-07-22 13:59:37 +00:00
|
|
|
if: env.GITHUB_REF_NAME == 'master'
|
|
|
|
|
2024-07-14 13:18:28 +00:00
|
|
|
- name: Build Dist
|
2024-11-11 07:06:48 +00:00
|
|
|
run: VITE_CODE_VERSION=$GITHUB_SHA bun dist
|
2024-07-22 13:59:37 +00:00
|
|
|
if: env.GITHUB_REF_NAME != 'master'
|
2024-07-14 13:18:28 +00:00
|
|
|
|
2024-07-14 14:05:12 +00:00
|
|
|
- name: Depoly to Preview
|
2024-07-14 12:58:55 +00:00
|
|
|
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
|
2024-07-14 14:15:02 +00:00
|
|
|
if: env.GITHUB_REF_NAME == 'master'
|
2024-07-14 14:05:12 +00:00
|
|
|
|
|
|
|
- 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
|
2024-07-14 14:15:02 +00:00
|
|
|
if: env.GITHUB_REF_NAME != 'master'
|
2024-07-14 12:58:55 +00:00
|
|
|
|