-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Site Preview | ||
|
||
on: | ||
pull_request | ||
|
||
env: | ||
ARTIFACT_NAME: BUILD_LOG | ||
NIX_VERSION: nix-2.14.1 | ||
NIXPKGS_CHANNEL: nixos-22.11 | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
preview: | ||
runs-on: beefy-runner | ||
outputs: | ||
preview-url: ${{ steps.publish-preview.outputs.preview-url }} | ||
permissions: write-all | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
- uses: cachix/install-nix-action@v20 | ||
with: | ||
nix_path: nixpkgs=channel:${{ env.NIXPKGS_CHANNEL }} | ||
github_access_token: ${{ github.token }} | ||
extra_nix_config: | | ||
trusted-public-keys = union.cachix.org-1:TV9o8jexzNVbM1VNBOq9fu8NK+hL6ZhOyOh0quATy+M= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | ||
substituters = https://union.cachix.org/ https://cache.nixos.org/ | ||
- run: | | ||
nix-channel --add https://nixos.org/channels/${{ env.NIXPKGS_CHANNEL }} nixpkgs | ||
nix-channel --update | ||
nix-env -iA nixpkgs.nodePackages.vercel | ||
- name: "Publish Preview to Vercel" | ||
id: publish-preview | ||
run: | | ||
cd site | ||
vercel pull --yes --environment=preview --token=${{secrets.VERCEL_TOKEN}} --scope unionbuild | ||
vercel build --token=${{secrets.VERCEL_TOKEN}} --scope unionbuild | ||
PREVIEW_URL=$(vercel deploy --prebuilt --token=${{secrets.VERCEL_TOKEN}} --scope unionbuild) | ||
echo "preview-url=${PREVIEW_URL}" >> "$GITHUB_OUTPUT" | ||
- name: Create Preview Comment | ||
if: github.event_name == 'pull_request' | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
mode: upsert | ||
message: | | ||
# Site Preview URL | ||
${{ steps.publish-preview.outputs.preview-url }} | ||
comment_tag: Site Preview URL | ||
GITHUB_TOKEN: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"outputDirectory": "result", | ||
"buildCommand": "nix build .\#site-static" | ||
} |