Skip to content

on build not deploy git actions #26

on build not deploy git actions

on build not deploy git actions #26

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy Node.js app to Azure Web App - slipspace
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Install dependencies
run: npm install
- name: Build React app
run: npm run build
- name: Set environment variables
run: |
echo "REACT_APP_GOOGLE_MAPS_API_KEY=${{ secrets.REACT_APP_GOOGLE_MAPS_API_KEY }}" >> .env.production
echo "TRIPADVISOR_API_KEY_ENV=${{ secrets.TRIPADVISOR_API_KEY_ENV }}" >> .env.production
echo "DUFFEL_API_KEY_ENV=${{ secrets.DUFFEL_API_KEY_ENV }}" >> .env.production
echo "OAG_API_KEY_ENV=${{ secrets.OAG_API_KEY_ENV }}" >> .env.production
echo "REACT_APP_LOCAL_API_URL=${{ secrets.REACT_APP_LOCAL_API_URL }}" >> .env.production
- name: Zip artifact for deployment
run: zip -r release.zip build .env.production
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: node-app
path: release.zip
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: node-app
- name: Unzip artifact for deployment
run: unzip release.zip
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v2
with:
app-name: 'slipspace'
slot-name: 'Production'
package: .