Deploy Demo to VPS #34
This file contains hidden or 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 Demo to VPS | |
| on: | |
| workflow_run: | |
| workflows: ["Publish"] | |
| types: | |
| - completed | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy-frontend: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository == 'TimChild/reflex-clerk-api' }} | |
| environment: | |
| name: demo | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check env vars set | |
| run: | | |
| if [ -z "${{ vars.CLERK_PUBLISHABLE_KEY }}" ]; then | |
| echo "CLERK_PUBLISHABLE_KEY is not set" | |
| exit 1 | |
| fi | |
| - name: Create .env | |
| run: | | |
| echo "CLERK_PUBLISHABLE_KEY=${{ vars.CLERK_PUBLISHABLE_KEY }}" >> .env | |
| # echo "CLERK_SECRET_KEY=${{ secrets.CLERK_SECRET_KEY }}" >> .env | |
| - name: Deploy frontend | |
| uses: TimChild/webserver-template/actions/deploy-reflex-frontend@main | |
| with: | |
| vps-ip: ${{ vars.VPS_IP }} | |
| site-name: ${{ vars.SITE_NAME }} | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| ssh-user: "webadmin" | |
| working-directory: clerk_api_demo | |
| - name: Remove .env | |
| if: always() | |
| run: rm .env | |
| deploy-backend: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository == 'TimChild/reflex-clerk-api' }} | |
| environment: | |
| name: demo | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check env vars set | |
| run: | | |
| if [ -z "${{ vars.CLERK_PUBLISHABLE_KEY }}" ]; then | |
| echo "CLERK_PUBLISHABLE_KEY is not set" | |
| exit 1 | |
| fi | |
| if [ -z "${{ secrets.CLERK_SECRET_KEY }}" ]; then | |
| echo "CLERK_SECRET_KEY is not set" | |
| exit 1 | |
| fi | |
| - name: Create .env | |
| run: | | |
| echo "CLERK_PUBLISHABLE_KEY=${{ vars.CLERK_PUBLISHABLE_KEY }}" >> .env | |
| echo "CLERK_SECRET_KEY=${{ secrets.CLERK_SECRET_KEY }}" >> .env | |
| - name: Deploy backend | |
| uses: TimChild/webserver-template/actions/deploy-reflex-backend@main | |
| with: | |
| vps-ip: ${{ vars.VPS_IP }} | |
| site-name: ${{ vars.SITE_NAME }} | |
| dotenv-path: .env | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| ssh-user: "webadmin" | |
| working-directory: clerk_api_demo | |
| - name: Remove .env | |
| if: always() | |
| run: rm .env |