-
Notifications
You must be signed in to change notification settings - Fork 0
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
5 changed files
with
100 additions
and
18 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,18 @@ | ||
name: build site | ||
|
||
description: build site artifacts | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: restore build artifacts | ||
uses: actions/cache/restore@v4 | ||
with: | ||
fail-on-cache-miss: true | ||
path: | | ||
packages/*/dist | ||
key: ${{ runner.os }}-build-artifacts-${{ hashfiles('packages/*/src', 'packages/*/package.json', '!packages/casts-theme/src/tokens/ts') }} | ||
|
||
- name: build site | ||
run: pnpm --filter 'site' build && cp ./site/dist/index.html ./site/dist/404.html | ||
shell: bash |
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
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
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,74 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: preview pr publish | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
pull-requests: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: 'pages' | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-artifacts: | ||
uses: ./.github/workflows/build-packages.yaml | ||
|
||
deploy: | ||
needs: build-artifacts | ||
runs-on: ubuntu-latest | ||
outputs: | ||
url: ${{ steps.surge.outputs.url }} | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: setup-environment | ||
uses: ./.github/actions/setup-environment | ||
|
||
- name: build site | ||
uses: ./.github/actions/build-site | ||
|
||
- name: find-pr | ||
uses: jwalton/gh-find-current-pr@master | ||
id: find-pr | ||
|
||
- name: deploy to surge | ||
id: surge | ||
run: | | ||
repository=${{github.repository}} | ||
project_name=${repository#*/} | ||
export DEPLOY_DOMAIN=https://preview-pr-${{ steps.find-pr.outputs.number }}-$project_name.surge.sh | ||
npx surge --project ./site/dist --domain $DEPLOY_DOMAIN --token ${{ secrets.CASTS_DESIGN_SURGE_TOKEN }} | ||
echo "url=$DEPLOY_DOMAIN" >> $GITHUB_OUTPUT | ||
pr-comment-preview-prepare: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: preview parepare | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
message: | | ||
![preview-is-preparing](https://github.com/moecasts/casts-design/assets/37169906/25e18e7c-4d9a-404b-ac7a-1d035b24d9d6) | ||
comment_tag: preview | ||
|
||
pr-comment-preview-ready: | ||
runs-on: ubuntu-latest | ||
needs: [deploy, pr-comment-preview-prepare] | ||
steps: | ||
- name: preview built | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
message: | | ||
[![preview-is-ready](https://github.com/moecasts/casts-design/assets/37169906/e35faa8b-d60b-4d86-af41-389734a4d61a)](${{ needs.deploy.outputs.url }}) | ||
comment_tag: preview |
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