Change to v4 #1245
Workflow file for this run
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
# .github/workflows/preview-env-deploy.yml | |
name: Deploy Preview Environment | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
env: | |
REGION: cn-n1 # set this to your LeanCloud region, e.g. cn-n1 | |
APP_ID: j1sU6A4GIEiCzwDu5l9Klk03-9Nh9j0Va # set this to your App ID on LeanCloud | |
GROUP: web # set this to your group, e.g. web | |
jobs: | |
deploy-preview-environment: | |
runs-on: ubuntu-latest | |
environment: | |
name: preview/${{ github.head_ref }} | |
url: ${{ env.PREVIEW_URL }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install lean-cli | |
run: | | |
sudo curl -L -o /bin/lean https://github.com/leancloud/lean-cli/releases/download/v1.2.3/lean-linux-x64 | |
sudo chmod +x /bin/lean | |
- name: Deploy | |
run: | | |
lean login --region ${{ env.REGION }} --token ${{ secrets.ACCESS_TOKEN }} | |
lean switch --region ${{ env.REGION }} --group ${{ env.GROUP }} ${{ env.APP_ID }} | |
PREVIEW_URL=$(lean preview deploy) | |
echo "PREVIEW_URL=$PREVIEW_URL" >> $GITHUB_ENV |