Skip to content

Deployment

Deployment #77

Workflow file for this run

name: Deployment
# read-write repo token
# access to secrets
on:
workflow_run:
workflows: ["Receive PR"]
types:
- completed
jobs:
upload:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: "Download Artifact"
uses: actions/download-artifact@v4
with:
name: pr.zip
- run: unzip pr.zip
- name: "Save PR number to env.number"
run: echo "number=$(cat ./pr/NR)" >> $GITHUB_ENV
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_HAPPY_DUNE_06C336600 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "dist" # App source code path
output_location: "dist" # Built app content directory - optional
deployment_environment: ${{ env.number }}
###### End of Repository/Build Configurations ########
- name: Comment URL on PR
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./pr/NR'));
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'This PR is deployed at ${{ steps.builddeploy.outputs.static_web_app_url }}'
});