Skip to content

refactoring: name fixups and reordering #716

refactoring: name fixups and reordering

refactoring: name fixups and reordering #716

Workflow file for this run

# GitHub Actions workflow file for deploying contents of "./web" to Azure static web app on each git branch push and more.
#
# The intended target Azure static web app is "kojamroz VS Enterprise Sub / game-rg / game-web", with deployment token secrets.AZURE_GAME_WEB_DEPLOYMENT_TOKEN
# https://portal.azure.com/#@spawarottijamro.onmicrosoft.com/resource/subscriptions/8695c84c-09a4-4b50-994f-a2fa7f36cc92/resourcegroups/game-rg/providers/Microsoft.Web/staticSites/game-web/staticsite
#
# This workflow file was originally generated using VS Code SWA extension, with
# yml 'name' property: "Azure Static Web Apps CI/CD"
# file name: azure-static-web-apps-zealous-sea-0ffc3931e.yml
#
# Later on I updated it based on
# - https://docs.github.com/en/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-to-azure-static-web-app
#
# For details, see:
# - docs/web_frontend_setup.md
# - https://aka.ms/swaworkflowconfig
name: Web frontend - Azure Static Web App CI/CD
env:
APP_LOCATION: "web" # location of the client code
# location of client code build output. Recommended by https://vitejs.dev/guide/static-deploy.html#azure-static-web-apps
OUTPUT_LOCATION: "dist"
on:
push:
branches:
- main
paths:
- "web/**"
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
workflow_dispatch:
permissions:
issues: write
contents: read
pull-requests: write
jobs:
build_and_deploy:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build And Deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_GAME_WEB_DEPLOYMENT_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: ${{ env.APP_LOCATION }}
output_location: ${{ env.OUTPUT_LOCATION }}
# No Azure functions. See https://aka.ms/swaworkflowconfig
skip_api_build: true
lint:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
name: Lint
defaults:
run:
working-directory: ./web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm clean-install
- run: npm run lint
- run: npm run prettier
test:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
name: Test
needs: build_and_deploy
defaults:
run:
working-directory: ./web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm clean-install
- run: npm run test:once -- --pool=forks --retry=1
close_pull_request:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request
steps:
- name: Close Pull Request
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_GAME_WEB_DEPLOYMENT_TOKEN }}
action: "close"
app_location: ${{ env.APP_LOCATION }}