Improve build size #35
This file contains hidden or 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: Build and Deploy | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| check-skip-ci: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_skip: ${{ steps.check.outputs.should_skip }} | |
| steps: | |
| - id: check | |
| name: Check if [skip ci] is in commit message | |
| run: | | |
| if echo "${{ github.event.head_commit.message || '' }}" | grep -i '\[skip ci\]'; then | |
| echo "should_skip=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "should_skip=false" >> $GITHUB_OUTPUT | |
| fi | |
| build-deploy: | |
| runs-on: ubuntu-latest | |
| needs: check-skip-ci | |
| if: needs.check-skip-ci.outputs.should_skip != 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install dependencies | |
| run: npm set legacy-peer-deps=true && npm i | |
| - name: Build project | |
| run: npm run b | |
| # Deploy to Cloudflare Pages | |
| - name: Deploy to Cloudflare Pages | |
| uses: cloudflare/pages-action@v1 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| projectName: electerm-web-demo | |
| directory: public | |
| gitHubToken: ${{ secrets.GITHUB_TOKEN }} |