Skip to content

Commit

Permalink
refactor(web): ♻️ customize stapp Build & Deploy Action
Browse files Browse the repository at this point in the history
  • Loading branch information
collinbarrett committed Jun 15, 2024
1 parent a4565bd commit 26f5bf8
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 47 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/azure-static-web-apps-blue-bush-0df07ac0f.yml

This file was deleted.

104 changes: 104 additions & 0 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Web - Build & Deploy

on:
push:
branches:
# - main # TODO: uncomment when merging nextjs to main
- nextjs # TODO: remove when merging nextjs to main
paths:
- .github/workflows/web.yml
- web/**
# TODO: uncomment when merging nextjs to main
# pull_request:
# types: [opened, synchronize, reopened, closed]
# branches:
# - main
# paths:
# - .github/workflows/web.yml
# - web/**

jobs:
build_and_deploy_staging:
name: Build & Deploy to Staging

runs-on: ubuntu-latest

# if: github.event_name == 'pull_request' && github.event.action != 'closed'
if: github.event_name == 'push'

environment:
name: nextjs-web
url: ${{ steps.builddeploy.outputs.static_web_app_url }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
cache-dependency-path: web/package-lock.json

- name: Install
run: npm ci
working-directory: ./web

- name: Run Prettier
run: npm run prettier
working-directory: ./web

- name: Run ESLint
run: npm run lint
working-directory: ./web

- name: Build & Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_STAPP_FILTERLISTS_NEXTJS_PROD }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: upload
app_location: ./web
output_location: ""

# build_and_deploy_production:
# name: Build & Deploy to Production

# runs-on: ubuntu-latest

# if: github.event_name == 'push'

# environment:
# name: production-web
# url: https://filterlists.com

# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: Build & Deploy
# id: builddeploy
# uses: Azure/static-web-apps-deploy@v1
# with:
# azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_STAPP_FILTERLISTS_PROD }}
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# action: upload
# app_location: ./web
# output_location: ""

# close_pull_request:
# name: Close Pull Request

# runs-on: ubuntu-latest

# if: github.event_name == 'pull_request' && github.event.action == 'closed'

# steps:
# - name: Close Pull Request
# uses: Azure/static-web-apps-deploy@v1
# with:
# azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_STAPP_FILTERLISTS_PROD }}
# action: close
# app_location: ./web
6 changes: 5 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"prettier": "npx prettier --check ."
},
"dependencies": {
"@radix-ui/react-icons": "^1.3.0",
Expand All @@ -29,5 +30,8 @@
"prettier": "3.3.2",
"tailwindcss": "^3.4.1",
"typescript": "^5"
},
"engines": {
"node": ">=v18.17.0"
}
}

0 comments on commit 26f5bf8

Please sign in to comment.