Hardcoding vars into react #23
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
name: Build and deploy Flask+React app to Azure Web App | |
on: | |
push: | |
branches: | |
- deployment # Assuming your main branch is where you merge your changes | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Build the React frontend | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Create .env file | |
run: | | |
cd frontend | |
touch .env | |
echo REACT_APP_DOMAIN=dev-igx0eff32n6l7436.us.auth0.com >> .env | |
echo REACT_APP_CLIENT_ID=l9uS8Pp86tE0Oy3G75wNgvfIOUXxhCyh >> .env | |
- name: Install frontend dependencies | |
run: | | |
cd frontend | |
npm install | |
- name: Build frontend | |
run: | | |
cd frontend | |
CI=false npm run build | |
- name: Move built files back to the root directory | |
run: | | |
cd frontend | |
mv build ../ | |
# Build the Python Flask backend | |
- name: Set up Python version | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Create and start virtual environment for backend | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
- name: Install backend dependencies | |
run: pip install -r requirements.txt | |
# Optional: Add step to run tests here (PyTest, Django test suites, etc.) | |
- name: Zip artifact for deployment | |
run: zip release.zip ./* -r | |
- name: Upload artifact for deployment jobs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-app | |
path: | | |
release.zip | |
!venv/ | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: 'Production' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
permissions: | |
id-token: write #This is required for requesting the JWT | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-app | |
- name: Unzip artifact for deployment | |
run: unzip release.zip | |
- name: Login to Azure | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_35AE0D5354CE442AA85B1F632B2B3044 }} | |
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_AD9909BF51824E408950E6DB2F4979EC }} | |
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_2DA8D7286A464C27AAA701D0E22A3D96 }} | |
- name: 'Deploy to Azure Web App' | |
uses: azure/webapps-deploy@v2 | |
id: deploy-to-webapp | |
with: | |
app-name: 'chunkify' | |
slot-name: 'Production' |