Merge pull request #27 from DIPSAS/dependabot/npm_and_yarn/vite-4.3.9 #68
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: [ main ] | |
env: | |
APP_LOCATION: "/" # location of your client code | |
API_LOCATION: "api" # location of your api source code - optional | |
APP_ARTIFACT_LOCATION: "dist" # location of client code build output | |
AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing deployment token for your static web app | |
permissions: | |
contents: read | |
jobs: | |
build_and_deploy_job: | |
environment: | |
name: Production | |
url: https://hello.open.dips.no | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
pull-requests: write # for Azure/static-web-apps-deploy to comment on PRs | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') | |
runs-on: ubuntu-latest | |
name: Build and Deploy | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Set custom hostname for static web app | |
id: sethostname | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az staticwebapp hostname set \ | |
--hostname hello.open.dips.no \ | |
--name hello-open-dips \ | |
--no-wait | |
- name: Build And Deploy | |
id: builddeploy | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ env.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing api token for app | |
action: "upload" | |
app_location: ${{ env.APP_LOCATION }} | |
api_location: ${{ env.API_LOCATION }} | |
app_artifact_location: ${{ env.APP_ARTIFACT_LOCATION }} | |
env: | |
VITE_DIPS_SUBSCRIPTION_KEY: '${{ secrets.VITE_DIPS_SUBSCRIPTION_KEY }}' |