diff --git a/.github/workflows/azure-static-web-apps-blue-bush-0df07ac0f.yml b/.github/workflows/azure-static-web-apps-blue-bush-0df07ac0f.yml deleted file mode 100644 index 6e22f272a..000000000 --- a/.github/workflows/azure-static-web-apps-blue-bush-0df07ac0f.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Azure Static Web Apps CI/CD - -on: - push: - branches: - - nextjs - pull_request: - types: [opened, synchronize, reopened, closed] - branches: - - nextjs - -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 - steps: - - uses: actions/checkout@v3 - with: - submodules: true - lfs: false - - name: Build And Deploy - id: builddeploy - uses: Azure/static-web-apps-deploy@v1 - with: - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLUE_BUSH_0DF07AC0F }} - repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) - action: "upload" - ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### - # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig - app_location: "./web" # App source code path - api_location: "" # Api source code path - optional - output_location: "" # Built app content directory - optional - ###### End of Repository/Build Configurations ###### - - 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 - with: - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLUE_BUSH_0DF07AC0F }} - action: "close" diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml new file mode 100644 index 000000000..06bbbf69a --- /dev/null +++ b/.github/workflows/web.yml @@ -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 diff --git a/web/next.config.mjs b/web/next.config.mjs index 4678774e6..5a13038ed 100644 --- a/web/next.config.mjs +++ b/web/next.config.mjs @@ -1,4 +1,6 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {}; +const nextConfig = { + output: 'standalone' +}; export default nextConfig; diff --git a/web/package.json b/web/package.json index d251c4b6c..9c5db765d 100644 --- a/web/package.json +++ b/web/package.json @@ -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", @@ -29,5 +30,8 @@ "prettier": "3.3.2", "tailwindcss": "^3.4.1", "typescript": "^5" + }, + "engines": { + "node": ">=v18.17.0" } }