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: Tencent Cloud Base Deploy | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: pages | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Install and Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: /home/runner/.local/share/pnpm/store | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('pnpm-lock.yaml') }} | |
- name: Install dependency and build | |
run: | | |
corepack enable | |
pnpm i | |
pnpm generate | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: .output/public | |
retention-days: 1 | |
deploy-cloudbase: | |
needs: build | |
runs-on: ubuntu-latest | |
name: Deploy Cloudbase | |
steps: | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: cloudbase-cli | |
restore-keys: cloudbase-cli | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: ./dist | |
- name: Push to Cloudbase | |
run: | | |
npm install -g @cloudbase/cli | |
npx tcb login --apiKeyId ${{SECRETS.SID}} --apiKey ${{SECRETS.SKEY}} | |
npx tcb hosting deploy ./dist . -e ${{SECRETS.ENVID}} | |
# uses: TencentCloudBase/[email protected] | |
# with: | |
# # 云开发 secretId | |
# secretId: ${{SECRETS.SID}} | |
# # 云开发 secretKey | |
# secretKey: ${{SECRETS.SKEY}} | |
# # 云开发环境 Id | |
# envId: ${{SECRETS.ENVID}} |