-
Notifications
You must be signed in to change notification settings - Fork 270
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
59 additions
and
28 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 |
---|---|---|
@@ -1,30 +1,10 @@ | ||
# 文件名建议统一为 preview-publish | ||
# 应用 preview.yml 的 demo | ||
name: preview site | ||
on: [pull_request] | ||
name: MAIN_PULL_REQUEST | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
build-site: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
- uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-nodemodules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- run: pnpm install | ||
- name: build-site | ||
run: pnpm run site:preview | ||
call-preview: | ||
uses: Tencent/tdesign/.github/workflows/preview.yml@main | ||
secrets: | ||
TDESIGN_SURGE_TOKEN: ${{ secrets.TDESIGN_SURGE_TOKEN }} | ||
call-test-build: | ||
uses: Tencent/tdesign/.github/workflows/test-build-site.yml@main |
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,51 @@ | ||
name: TEST_AND_BUILD | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
site: | ||
runs-on: ubuntu-latest | ||
# needs: test | ||
steps: | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
- uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-nodemodules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- run: pnpm install | ||
- name: Build site | ||
run: npm run site:preview | ||
|
||
- run: | | ||
zip -r _site.zip _site | ||
- name: upload _site artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: _site | ||
path: _site.zip | ||
retention-days: 5 | ||
|
||
- name: Save PR number | ||
if: ${{ always() }} | ||
run: echo ${{ github.event.number }} > ./pr-id.txt | ||
|
||
- name: Upload PR number | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: pr | ||
path: ./pr-id.txt |