-
Notifications
You must be signed in to change notification settings - Fork 32
46 lines (43 loc) · 1.55 KB
/
pull-request-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Pull Request (Deployment)
on:
pull_request:
types: [ synchronize, labeled ]
permissions:
contents: read
pull-requests: write
jobs:
pull-request-deploy:
if: ${{ contains(github.event.pull_request.labels.*.name, 'Deploy PR') }}
name: Publish Web-Application (Preview)
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }} @ ${{ github.ref }}
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install NPM Packages
run: npm install
- name: Build Web-Application
run: npm run build --workspace=web
- name: Deploy App to CloudFlare
id: deploy
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy ./web/build --project-name=haruneko --commit-dirty=true
- name: Comment Deployment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '## 🔥 Preview Deployment\nRun the command below to preview this pull-request directly in HaruNeko\n```sh\nhakuneko.exe --origin=${{ steps.deploy.outputs.deployment-url }}\n```'
})