fix(org): fix selector have no default value #44
Workflow file for this run
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
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| name: Build Project | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Use Yarn 4 | |
| run: corepack enable | |
| - name: Inject Environment Variables | |
| run: | | |
| echo "PUBLIC_API_URL=${{ vars.PUBLIC_API_URL }}" >> .env | |
| - name: Build | |
| run: yarn install --immutable && yarn build | |
| - name: Upload Build Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-files | |
| path: dist/ | |
| retention-days: 1 | |
| deploy-cloudflare: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| contents: read | |
| deployments: write | |
| name: Deploy to Cloudflare Pages | |
| steps: | |
| - name: Download Build Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-files | |
| path: dist/ | |
| - name: Deploy to Cloudflare Pages | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy dist --project-name=fcc-cms-6b4t | |
| gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
| deploy-qcloud: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| contents: read | |
| deployments: write | |
| pull-requests: write | |
| name: Deploy to QCloud Pages | |
| steps: | |
| - name: Download Build Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-files | |
| path: dist/ | |
| - name: Deploy to QCloud Pages | |
| id: deploy | |
| run: | | |
| npm install -g edgeone | |
| if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
| edgeone pages deploy ./dist -n fcc-dashboard -t ${{ secrets.QCLOUD_PAGES_TOKEN }} 2>&1 | tee deploy.log | |
| else | |
| edgeone pages deploy ./dist -n fcc-dashboard -e preview -t ${{ secrets.QCLOUD_PAGES_TOKEN }} 2>&1 | tee deploy.log | |
| fi | |
| - name: Extract Preview URL | |
| id: extract-url | |
| run: | | |
| # 从部署日志中提取预览地址 | |
| if [ -f deploy.log ]; then | |
| PREVIEW_URL=$(grep -o 'EDGEONE_DEPLOY_URL=https://[^[:space:]]*' deploy.log | head -1 | sed 's/EDGEONE_DEPLOY_URL=//') | |
| if [ -n "$PREVIEW_URL" ]; then | |
| echo "preview_url=$PREVIEW_URL" >> $GITHUB_OUTPUT | |
| echo "Found preview URL: $PREVIEW_URL" | |
| else | |
| echo "No preview URL found in deployment log" | |
| echo "preview_url=" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "Deploy log not found" | |
| echo "preview_url=" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Comment on PR | |
| if: github.event_name == 'pull_request' && steps.extract-url.outputs.preview_url != '' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const previewUrl = '${{ steps.extract-url.outputs.preview_url }}'; | |
| const comment = `🚀 **预览部署完成!** | |
| 📱 **预览地址**: ${previewUrl} | |
| > 此预览链接将在部署完成后可用,请稍等片刻再访问。 | |
| --- | |
| *由 GitHub Actions 自动生成*`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: comment | |
| }); |