Update exclusions.md - delete one symbol #1438
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: Build and deploy | |
env: | |
BASE_DOMAIN: kb-vpn.pages.dev | |
BASE_PATH: / | |
PAGES_PROJECT: kb-vpn | |
on: | |
push: | |
branches: | |
- "*" | |
tags: | |
- v* | |
pull_request: | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: node:20 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Determine branch for deploy | |
id: get-branch | |
run: | | |
if [ "${{ github.ref_name }}" = "master" ]; then | |
echo "BRANCH_NAME=main" >> $GITHUB_ENV | |
elif [ "${{ github.event_name }}" = "pull_request" ]; then | |
PR_NUMBER=${{ github.event.number }} | |
echo "BRANCH_NAME=pull-request-${PR_NUMBER}" >> $GITHUB_ENV | |
else | |
echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV | |
fi | |
- name: Run build | |
run: | | |
URL=https://${{ env.BASE_DOMAIN }} BASE_URL=${{ env.BASE_PATH }} pnpm build | |
# Disable crawlers for preview builds. | |
echo "User-Agent: *\nDisallow: /" > build/robots.txt | |
- name: Install Wrangler | |
if: github.event.pull_request.head.repo.fork == false | |
run: npm install -g wrangler | |
- name: Deploy to Cloudflare Pages | |
if: github.event.pull_request.head.repo.fork == false | |
run: npx wrangler pages deploy ./build --project-name="${{ env.PAGES_PROJECT }}" --branch ${{ env.BRANCH_NAME }} | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKERS_API_TOKEN }} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_WORKERS_ACCOUNT_ID }} | |
- name: Add comment to Pull Request | |
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `Preview was deployed to: https://${{ env.BRANCH_NAME }}.${{ env.BASE_DOMAIN }}${{ env.BASE_PATH }}` | |
}) |