Yml changes #7
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: Azure Static Web Apps CI/CD | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build_and_deploy_job: | |
runs-on: ubuntu-latest | |
name: Build and Deploy Job | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
lfs: false | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Create .env File | |
run: | | |
echo "REACT_APP_BACKEND_BASE_API=${{ secrets.REACT_APP_BACKEND_BASE_API }}" >> .env | |
echo "REACT_APP_LOCAL_DEVELOPMENT_MODE=${{ secrets.REACT_APP_LOCAL_DEVELOPMENT_MODE }}" >> .env | |
cat .env # Debugging: Check if .env is created properly (values will be masked) | |
- name: Install Dependencies | |
run: npm install | |
- name: Build React App | |
run: npm run build | |
env: | |
REACT_APP_BACKEND_BASE_API: ${{ secrets.REACT_APP_BACKEND_BASE_API }} | |
REACT_APP_LOCAL_DEVELOPMENT_MODE: ${{ secrets.REACT_APP_LOCAL_DEVELOPMENT_MODE }} | |
- name: Deploy to Azure Static Web Apps | |
id: builddeploy | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for GitHub PR comments | |
action: "upload" | |
app_location: "/" # Adjust if your React app is in a subfolder | |
api_location: "" # API source code path - optional | |
output_location: "build" # Path to the built React app |