chore: fixup if #15
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
name: deploy | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- README.md | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- run: npm install | |
- run: npm run build | |
- name: Extract Sandbox | |
run: | | |
# extract prebuilt codesandbox, to reduce build time | |
wget -O- https://github.com/NetEase/codesandbox-client/releases/latest/download/codesandbox.tar.xz | tar xJvf - -C ./dist | |
# redirect root path to /designer if it's not in iframe | |
sed -i "s|</head>|<script>(function(){if(window.top===window)window.location.href=\"/designer\"})()</script></head>|" ./dist/index.html | |
- name: Add CNAME | |
run: echo "tango-demo.musicfe.com" > ./dist/CNAME | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
publish_dir: ./dist | |
github_token: ${{ secrets.GITHUB_TOKEN }} |