From e52f2843247e84c8af4cb7ea6d2c1e8bba033e1d Mon Sep 17 00:00:00 2001 From: Collin Barrett Date: Wed, 12 Jun 2024 21:46:43 +0000 Subject: [PATCH] ci: add Azure Static Web Apps workflow file on-behalf-of: @Azure opensource@microsoft.com --- .github/dependabot.yml | 4 +-- .github/workflows/web.yml | 60 ++++++++++++++++++++++++++++++++++++ web/staticwebapp.config.json | 6 ++++ 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/web.yml create mode 100644 web/staticwebapp.config.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4016543b1..f79a99088 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -16,12 +16,12 @@ updates: directory: services/FilterLists.AppHost schedule: interval: daily - target-branch: aspire + target-branch: aspire # TODO: rm when merging aspire to main - package-ecosystem: nuget directory: services/FilterLists.Tests schedule: interval: daily - target-branch: aspire + target-branch: aspire # TODO: rm when merging aspire to main - package-ecosystem: docker directory: /web schedule: diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml new file mode 100644 index 000000000..fbc035f24 --- /dev/null +++ b/.github/workflows/web.yml @@ -0,0 +1,60 @@ +name: Web - Build & Deploy + +on: + push: + branches: + - main + - aspire # TODO: rm when merging aspire to main + paths: + - .github/workflows/web.yml + - web/** + # TODO: uncomment when merging aspire to main + # pull_request: + # types: [opened, synchronize, reopened, closed] + # branches: + # - main + # paths: + # - .github/workflows/web.yml + # - web/** + +jobs: + build_and_deploy_job: + name: Build and Deploy + + runs-on: ubuntu-latest + + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') + + environment: + name: production + url: https://aspire.filterlists.com # TODO: change to root when merging aspire to main + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - 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_STAPP_FILTERLISTS_PROD }} + repo_token: ${{ secrets.GITHUB_TOKEN }} + action: "upload" + app_location: "./web" + output_location: "build" + + close_pull_request_job: + name: Close Pull Request + + runs-on: ubuntu-latest + + if: github.event_name == 'pull_request' && github.event.action == 'closed' + + 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_STAPP_FILTERLISTS_PROD }} + action: "close" + app_location: "./web" \ No newline at end of file diff --git a/web/staticwebapp.config.json b/web/staticwebapp.config.json new file mode 100644 index 000000000..1567bc5b8 --- /dev/null +++ b/web/staticwebapp.config.json @@ -0,0 +1,6 @@ +{ + "navigationFallback": { + "rewrite": "/index.html" + }, + "trailingSlash": "never" +} \ No newline at end of file