Something went wrong. Try again.
A comprehensive digital solution dedicated to bridging the gap between those offering services and those seeking them, providing a centrali… gigwork.co.in
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364name: Deploy Admin Panel
on: workflow_dispatch: inputs: environment: description: "Select environment (STAGE or PROD)" required: true default: "STAGE" type: choice options: - STAGE - PROD
jobs: deploy: runs-on: ubuntu-latest
steps: - name: Checkout code uses: actions/checkout@v3
- name: Set up Node.js uses: actions/setup-node@v3 with: node-version: 18
- name: Install dependencies working-directory: ./admin run: npm install
- name: Set environment variables working-directory: ./admin run: | if [[ "${{ github.event.inputs.environment }}" == "PROD" ]]; then echo "VITE_BASE_URL=${{ secrets.VITE_BASE_URL_PROD }}" >> .env echo "VITE_ASSET_BASE_URL=${{ secrets.VITE_ASSET_BASE_URL_PROD }}" >> .env else echo "VITE_BASE_URL=${{ secrets.VITE_BASE_URL_STAGE }}" >> .env echo "VITE_ASSET_BASE_URL=${{ secrets.VITE_ASSET_BASE_URL_STAGE }}" >> .env fi shell: bash
- name: Build the project working-directory: ./admin run: npm run build
- name: Deploy to Cloudflare Pages working-directory: ./admin env: CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN_STAGE }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID_STAGE }} CLOUDFLARE_PROJECT_NAME: gigworks-admin run: | npm install -g @cloudflare/wrangler if [[ "${{ github.event.inputs.environment }}" == "PROD" ]]; then export CLOUDFLARE_API_TOKEN=${{ secrets.CF_API_TOKEN_PROD }} export CLOUDFLARE_ACCOUNT_ID=${{ secrets.CF_ACCOUNT_ID_PROD }} export CLOUDFLARE_PROJECT_NAME=${{ secrets.CF_PROJECT_NAME_PROD }} fi npm run deploy
- name: Notify success run: echo "Deployment to ${{ github.event.inputs.environment }} successful!"