-
Notifications
You must be signed in to change notification settings - Fork 11
65 lines (65 loc) · 2.66 KB
/
main.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: "build"
on:
push:
pull_request_target:
branches: ["main"]
env:
cloudflare_project: noogle
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: nix-community
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
# Since ubuntu 22.30, unprivileged usernamespaces are no longer allowed to map to the root user:
# https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces
# This is a workaround needed to build nix itself in github actions
- run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
- run: nix build .#ui -L
- name: Publish to Cloudflare Pages
if: github.event_name == 'push'
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ env.cloudflare_project }}
directory: ./result/lib/node_modules/noogle/out
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Cloudflare Pages
id: publish
if: github.event_name == 'pull_request_target'
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: noogle
directory: ./result/lib/node_modules/noogle/out
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: pr-${{ github.event.pull_request.number }}
- uses: peter-evans/create-or-update-comment@v3
if: github.event_name == 'pull_request_target'
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
<!-- DEPLOYMENT_COMMENT -->
<table><tr><td><strong>Latest commit:</strong> </td><td>
<code>${{ github.event.pull_request.head.sha }}</code>
</td></tr>
<tr><td><strong>Preview URL:</strong></td><td>
<a href='${{ steps.publish.outputs.url }}'>${{ steps.publish.outputs.url }}</a>
</td></tr>
<tr><td><strong>Branch Preview URL:</strong></td><td>
<a href='https://pr-${{ github.event.pull_request.number }}.${{ env.cloudflare_project }}.pages.dev'>https://pr-${{ github.event.pull_request.number }}.${{ env.cloudflare_project }}.pages.dev</a>
</td></tr>
</table>
edit-mode: replace