2022-11-26 12:59:27 +03:00
|
|
|
name: "build"
|
|
|
|
on:
|
|
|
|
push:
|
2022-11-30 15:11:47 +03:00
|
|
|
pull_request_target:
|
|
|
|
branches: [ "main" ]
|
|
|
|
env:
|
|
|
|
cloudflare_project: noogle
|
2022-11-26 12:59:27 +03:00
|
|
|
jobs:
|
2022-11-26 13:05:50 +03:00
|
|
|
deploy:
|
2022-11-26 12:59:27 +03:00
|
|
|
runs-on: ubuntu-latest
|
2022-11-30 15:11:47 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
deployments: write
|
|
|
|
pull-requests: write
|
2022-11-26 12:59:27 +03:00
|
|
|
steps:
|
2023-10-02 05:35:29 +03:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: cachix/install-nix-action@v23
|
2022-12-03 17:36:54 +03:00
|
|
|
with:
|
|
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
2023-04-19 14:52:20 +03:00
|
|
|
- uses: cachix/cachix-action@v12
|
2022-11-26 13:05:50 +03:00
|
|
|
with:
|
2023-11-15 11:19:12 +03:00
|
|
|
name: nix-community
|
2022-12-03 17:32:04 +03:00
|
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
2023-11-29 23:40:20 +03:00
|
|
|
- run: nix build .#ui -L
|
2022-12-03 17:34:23 +03:00
|
|
|
- name: Publish to Cloudflare Pages
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
uses: cloudflare/pages-action@1
|
|
|
|
with:
|
2022-11-30 15:11:47 +03:00
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
projectName: ${{ env.cloudflare_project }}
|
2023-11-29 23:40:20 +03:00
|
|
|
directory: ./result/lib/node_modules/noogle/out
|
2022-11-30 15:11:47 +03:00
|
|
|
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
|
2023-11-29 23:40:20 +03:00
|
|
|
directory: ./result/lib/node_modules/noogle/out
|
2022-11-30 15:11:47 +03:00
|
|
|
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
branch: pr-${{ github.event.pull_request.number }}
|
2023-10-02 05:35:29 +03:00
|
|
|
- uses: peter-evans/create-or-update-comment@v3
|
2022-11-30 15:11:47 +03:00
|
|
|
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
|