fix: missing dependencies for calendar #10
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: Publish www | |
on: | |
push: | |
branches: | |
- dev | |
paths: | |
- 'apps/www/**' | |
pull_request: | |
branches: | |
- dev | |
paths: | |
- 'apps/www/**' | |
# Triggers the workflow on pull request event, but only for pull request opened or pull request labeled with "🚀request-deploy" (from forked repo) | |
# pull_request is not allowed to use secrets, so we use pull_request_target instead (in forked repos) | |
pull_request_target: | |
types: | |
# When a created pull request from forked repo, it will be comment 'Should deploy to add label' | |
- opened | |
# When a labeled '🚀request-deploy' pull request from forked repo, it will be deploy to Cloudflare Pages | |
- labeled | |
permissions: | |
# default contents: read & write (in forked repos, only read) | |
contents: write | |
# default deployments: read & write (in forked repos, only read) | |
deployments: write | |
# default pull-requests: read & write (in forked repos, only read) | |
pull-requests: write | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
name: Publish to Cloudflare Pages | |
if: ${{ | |
github.event_name == 'push' || | |
github.event_name == 'workflow_dispatch' || | |
github.event_name == 'pull_request' || | |
(github.event_name == 'pull_request_target' && | |
github.event.action == 'labeled' && | |
github.event.pull_request.head.repo.fork == true && | |
contains(github.event.label.name, '🚀request-deploy')) | |
}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Run a build step here | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Build www | |
run: pnpm build | |
# Run a action to publish docs | |
- name: Publish to Cloudflare Pages | |
uses: cloudflare/[email protected] | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: shadcn-vue | |
directory: .vitepress/dist | |
# Optional: Enable this if you want to have GitHub Deployments triggered | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
# Optional: Switch what branch you are publishing to. | |
# By default this will be the branch which triggered this workflow | |
# branch: main | |
# Optional: Change the working directory | |
workingDirectory: apps/www | |
wranglerVersion: '3' | |
- name: Remove label | |
if: ${{ github.event_name == 'pull_request_target' && contains(github.event.label.name, '🚀request-deploy') }} | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: ['🚀request-deploy'] | |
}) |