weather app #3
This file contains hidden or 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 to staging | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Install dependencies and build | |
working-directory: ./weather-app | |
run: | | |
npm install | |
npm run build | |
- name: Zip artifact for deployment | |
working-directory: ./weather-app | |
run: zip -r ../release.zip ./* | |
- name: Upload artifact for deployment job | |
uses: actions/upload-artifact@v4 | |
with: | |
name: node-app | |
path: release.zip | |
deploy-staging: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: 'Staging' | |
url: ${{ steps.deploy-to-webapp-staging.outputs.webapp-url }} | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: node-app | |
- name: Unzip artifact for deployment | |
run: unzip release.zip | |
- name: Login to Azure | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID }} | |
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_F0A2C46FD2B74B6EBF701F4F68664556 }} | |
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_6A39DE00D4CD4142A2B79B40F2FB0C5A }} | |
- name: 'Deploy to Azure Web App Staging' | |
id: deploy-to-webapp-staging | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: 'az204svelte' | |
slot-name: 'stage1' | |
package: '.' |