From 5409b339925f7e58ff6c26758ffc94e0f10e6077 Mon Sep 17 00:00:00 2001 From: broki <61258338+brokiem@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:43:25 +0800 Subject: [PATCH 1/4] docs: corrected a url typo (#279) --- apps/www/src/content/docs/about.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/www/src/content/docs/about.md b/apps/www/src/content/docs/about.md index 21e9e6be..9e48890a 100644 --- a/apps/www/src/content/docs/about.md +++ b/apps/www/src/content/docs/about.md @@ -5,7 +5,7 @@ description: Powered by amazing open source projects. ## About -[shadcn-vue](https://shadcn-vuee.com) is a port of [shadcn/ui](https://ui.shadcn.com) for Vue/Nuxt. It's maintained by [radix-vue](https://github.com/radix-vue). +[shadcn-vue](https://shadcn-vue.com) is a port of [shadcn/ui](https://ui.shadcn.com) for Vue/Nuxt. It's maintained by [radix-vue](https://github.com/radix-vue). ## Credits @@ -17,4 +17,4 @@ description: Powered by amazing open source projects. ## License -MIT © [shadcn](https://shadcn.com) & [radix-vue](https://github.com/radix-vue) \ No newline at end of file +MIT © [shadcn](https://shadcn.com) & [radix-vue](https://github.com/radix-vue) From 84d2c4f1a664d5f7d800bac250e264774ce729b5 Mon Sep 17 00:00:00 2001 From: zernonia Date: Tue, 16 Jan 2024 23:08:25 +0800 Subject: [PATCH 2/4] chore: test using ref sha --- .github/workflows/publish.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 8c407ce8..e4d64b66 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -52,6 +52,14 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + fetch-depth: 0 + + - name: Print pull request head information + run: | + echo "Pull Request SHA: ${{ github.event.pull_request.head.sha }}" + echo "Pull Request Ref: ${{ github.event.pull_request.head.ref }}" # Run a build step here - name: Setup Node.js environment From 1f0a992212aecc35482c323cd7cc8dec6d2cd3aa Mon Sep 17 00:00:00 2001 From: zernonia Date: Tue, 16 Jan 2024 23:26:37 +0800 Subject: [PATCH 3/4] chore: purposely set branch name --- .github/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index e4d64b66..4096ca8f 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -104,7 +104,7 @@ jobs: 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 + branch: refs/pull/${{ github.event.number }}/merge # Optional: Change the working directory workingDirectory: apps/www wranglerVersion: '3' From fbd84e86ecdbbcab5edf066e164cc36226d8eb14 Mon Sep 17 00:00:00 2001 From: zernonia Date: Wed, 17 Jan 2024 00:08:58 +0800 Subject: [PATCH 4/4] chore: try another actions --- .github/workflows/publish.yaml | 125 ++++++--------------------------- 1 file changed, 22 insertions(+), 103 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 4096ca8f..e04e1c0b 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -11,55 +11,21 @@ on: - dev paths: - 'apps/www/**' - 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 - paths: - - 'apps/www/**' # Allows you to run this workflow manually from the Actions tab # eslint-disable-next-line yml/no-empty-mapping-value workflow_dispatch: -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 + permissions: + contents: read + deployments: write name: Publish to Cloudflare Pages - # push event in main branch - # workflow_dispatch event - # pull_request event from not forked repo - # pull_request_target event with label "🚀request-deploy" from forked repo - if: ${{ - github.event_name == 'push' || - github.event_name == 'workflow_dispatch' || - (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) || - (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 - with: - ref: ${{ github.event.pull_request.head.sha || github.ref }} - fetch-depth: 0 - - - name: Print pull request head information - run: | - echo "Pull Request SHA: ${{ github.event.pull_request.head.sha }}" - echo "Pull Request Ref: ${{ github.event.pull_request.head.ref }}" # Run a build step here - name: Setup Node.js environment @@ -94,72 +60,25 @@ jobs: # Run a action to publish docs - name: Publish to Cloudflare Pages - uses: cloudflare/pages-action@v1.5.0 + uses: unlike-ltd/github-actions-cloudflare-pages@v1.1.2 with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - projectName: shadcn-vue + cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }} + cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + cloudflare-project-name: 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: refs/pull/${{ github.event.number }}/merge - # Optional: Change the working directory - workingDirectory: apps/www - wranglerVersion: '3' - - - name: Create PR comment - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} - uses: mshick/add-pr-comment@v2 - with: - message: | - ### ⚡ Successfully Cloudflare Pages deployed! - | Name | Link | - | :--- | :--- | - | Latest commit | ${{ github.event.pull_request.head.sha || github.sha }} | - | Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | - | Deploy Preview Url | [${{ steps.cloudflare-pages-deploy.outputs.url }}](${{ steps.cloudflare-pages-deploy.outputs.url }}) | - | Environment | ${{ steps.cloudflare-pages-deploy.outputs.environment }} | - - - 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'] - }) - - # Comment on PR from the fork - comment: - name: Comment - runs-on: ubuntu-latest - - # pull_request_target opened event from forked repo - if: ${{ - github.event_name == 'pull_request_target' && - github.event.action == 'opened' && - github.event.pull_request.head.repo.fork == true - }} - - steps: - - name: Create PR comment - run: | - cat << EOF > comment.md - # ⚠️ \`🚀request-deploy\` label is required for deployment - - This repository is a forked repository. - Due to security reasons, deployment from forked repositories does not happen automatically. - - To request deployment, please add the \`🚀request-deploy\` label to this pull request. - (Only certain members have the ability to add labels.) - EOF - - gh pr comment ${{ github.event.number }} -R ${{ github.repository }} -F comment.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github-environment: ${{ github.event.pull_request.head.ref }} + # uses: cloudflare/pages-action@v1.5.0 + # 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: refs/pull/${{ github.event.number }}/merge + # # Optional: Change the working directory + # workingDirectory: apps/www + # wranglerVersion: '3'