Skip to content

Commit

Permalink
feat(react)!: update swa cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
victorfrye committed Oct 7, 2024
1 parent d8583a2 commit 2a304e6
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 47 deletions.

This file was deleted.

74 changes: 74 additions & 0 deletions .github/workflows/azure-swa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Azure Static Web Apps CI/CD

on:
push:
branches: ['main']
pull_request:
types: [opened, synchronize, reopened, closed]
branches: ['main']

permissions:
contents: read
pull-requests: write

env:
NODE_VERSION: '22.x'

jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
environment: ${{ github.event_name == 'push' && 'Production' || 'Staging' }}
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
lfs: false

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: npm ci

- name: Verify formatting
run: npm run lint:check

- name: Build sources
run: npm run build

- name: Deploy static web app
id: deploy
uses: Azure/static-web-apps-deploy@v1
env:
SKIP_DEPLOY_ON_MISSING_SECRETS: ${{ github.event_name == 'pull_request' }}
IS_STATIC_EXPORT: true
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_SWA_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: 'upload'
app_location: 'out'
skip_app_build: true
skip_api_build: true

close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close pull request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
env:
SKIP_DEPLOY_ON_MISSING_SECRETS: ${{ github.event_name == 'pull_request' }}
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_SWA_TOKEN }}
action: 'close'
app_location: ''
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

The virtual graveyard for remembering those killed by Microsoft

[![Azure CI/CD](https://github.com/victorfrye/microsoftgraveyard/actions/workflows/azure-webapp.yml/badge.svg)](https://github.com/victorfrye/microsoftgraveyard/actions/workflows/azure-webapp.yml)
[![Azure Static Web Apps CI/CD](https://github.com/victorfrye/microsoftgraveyard/actions/workflows/azure-swa.yml/badge.svg)](https://github.com/victorfrye/microsoftgraveyard/actions/workflows/azure-swa.yml)
[![CodeQL](https://github.com/victorfrye/microsoftgraveyard/actions/workflows/codeql.yml/badge.svg)](https://github.com/victorfrye/microsoftgraveyard/actions/workflows/codeql.yml)
[![GitHub Issues](https://img.shields.io/github/issues/victorfrye/microsoftgraveyard)](https://github.com/victorfrye/microsoftgraveyard/issues)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](/.github/CODE_OF_CONDUCT.md)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](/LICENSE)
Expand Down

0 comments on commit 2a304e6

Please sign in to comment.