Merge pull request #22 from vitelabs/test #12
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 To Cloudflare [Prod] | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Read .nvmrc | |
id: nvm | |
run: echo "NVMRC=$(cat .nvmrc)" >> "$GITHUB_OUTPUT" | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '${{ steps.nvm.outputs.NVMRC }}' | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ubuntu-node-v${{ steps.nvm.outputs.NVMRC }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package.json')) }} | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Build | |
run: npm run build | |
env: | |
NITRO_PRESET: cloudflare_module | |
NODE_OPTIONS: "--max_old_space_size=4096" | |
- name: Publish to Cloudflare | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
environment: 'production' |