mirror of
https://github.com/hsjobeki/noogle.git
synced 2024-12-24 22:42:58 +03:00
65 lines
2.3 KiB
YAML
65 lines
2.3 KiB
YAML
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@v3
|
|
- uses: cachix/install-nix-action@v18
|
|
with:
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
- uses: cachix/cachix-action@v11
|
|
with:
|
|
name: noogle
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
extra_nix_config: |
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
- run: nix build
|
|
- 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/static
|
|
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/static
|
|
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
branch: pr-${{ github.event.pull_request.number }}
|
|
- uses: peter-evans/create-or-update-comment@v2
|
|
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
|