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 a1d1968
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 49 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/azure-static-web-apps-blue-bush-0df07ac0f.yml

This file was deleted.

105 changes: 105 additions & 0 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
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
name: Build & Deploy to Next.js 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
4 changes: 3 additions & 1 deletion web/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
output: 'standalone'
};

export default nextConfig;
8 changes: 6 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build": "next build && cp -r .next/static .next/standalone/.next/ && cp -r public .next/standalone/",
"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 a1d1968

Please sign in to comment.