mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-08-28 19:48:01 +08:00
Add new workflow action and Fix cleanup bug (#355)
* Create frontend_pagefunction_deploy.yaml * Update frontend_pagefunction_deploy.yaml * Update cleanup_api.ts * Update common.ts * Update cleanup_api.ts * Update common.ts
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
name: Deploy Frontend with page function
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
|
- uses: pnpm/action-setup@v3
|
||||||
|
name: Install pnpm
|
||||||
|
id: pnpm-install
|
||||||
|
with:
|
||||||
|
version: 8
|
||||||
|
run_install: false
|
||||||
|
|
||||||
|
- name: Deploy Frontend for ${{ github.ref_name }}
|
||||||
|
run: |
|
||||||
|
cd frontend/
|
||||||
|
pnpm install --no-frozen-lockfile
|
||||||
|
pnpm build:pages
|
||||||
|
cd ../pages/
|
||||||
|
echo '${{ secrets.PAGE_TOML }}' > wrangler.toml
|
||||||
|
pnpm install --no-frozen-lockfile
|
||||||
|
pnpm run deploy
|
||||||
|
echo "Deploying prodcution for ${{ github.ref_name }}"
|
||||||
|
env:
|
||||||
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
@@ -78,7 +78,7 @@ export const cleanup = async (
|
|||||||
cleanType: string | undefined | null,
|
cleanType: string | undefined | null,
|
||||||
cleanDays: number | undefined | null
|
cleanDays: number | undefined | null
|
||||||
): Promise<boolean> => {
|
): Promise<boolean> => {
|
||||||
if (!cleanType || !cleanDays || cleanDays < 0 || cleanDays > 30) {
|
if (!cleanType || typeof cleanDays !== 'number' || cleanDays < 0 || cleanDays > 30) {
|
||||||
throw new Error("Invalid cleanType or cleanDays")
|
throw new Error("Invalid cleanType or cleanDays")
|
||||||
}
|
}
|
||||||
console.log(`Cleanup ${cleanType} before ${cleanDays} days`);
|
console.log(`Cleanup ${cleanType} before ${cleanDays} days`);
|
||||||
|
|||||||
Reference in New Issue
Block a user