Skip to content

Commit

Permalink
on build not deploy git actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornweb committed Apr 5, 2024
1 parent 9adf7a5 commit 5e8fd44
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions .github/workflows/main_slipspace.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 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:
Expand All @@ -16,19 +19,27 @@ jobs:
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '20.x'
node-version: '14.x'

- name: Install dependencies
run: npm install

- name: npm install, build, and test
- name: Build React app
run: npm run build

- name: Set environment variables
run: |
npm install
npm run build --if-present
npm run test --if-present
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 release.zip ./* -r
run: zip -r release.zip build .env.production

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v2
with:
name: node-app
path: release.zip
Expand All @@ -40,34 +51,18 @@ jobs:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT
id-token: write

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
uses: actions/download-artifact@v2
with:
name: node-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_8D61FDF6CC7E404A98BC96270945C9F7 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_D0F9FEB8912341D0A5A96465DB76B94E }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4B37E3B0B485419C98F491DEA14A2506 }}

- name: Set environment variables
run: |
echo "REACT_APP_GOOGLE_MAPS_API_KEY=${{ secrets.REACT_APP_GOOGLE_MAPS_API_KEY }}" >> $GITHUB_ENV
echo "TRIPADVISOR_API_KEY_ENV=${{ secrets.TRIPADVISOR_API_KEY_ENV }}" >> $GITHUB_ENV
echo "DUFFEL_API_KEY_ENV=${{ secrets.DUFFEL_API_KEY_ENV }}" >> $GITHUB_ENV
echo "OAG_API_KEY_ENV=${{ secrets.OAG_API_KEY_ENV }}" >> $GITHUB_ENV
echo "REACT_APP_LOCAL_API_URL=${{ secrets.REACT_APP_LOCAL_API_URL }}" >> $GITHUB_ENV

- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'slipspace'
Expand Down

0 comments on commit 5e8fd44

Please sign in to comment.