From 08e1750b299990c27780c3cc0b50127af6e35d1f Mon Sep 17 00:00:00 2001 From: Geoff Rich <4992896+geoffrich@users.noreply.github.com> Date: Tue, 18 Oct 2022 15:43:44 -0700 Subject: [PATCH 1/7] ci: add Azure Static Web Apps workflow file on-behalf-of: @Azure opensource@microsoft.com --- ...tatic-web-apps-polite-desert-00b80111e.yml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml diff --git a/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml b/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml new file mode 100644 index 00000000..03a9249b --- /dev/null +++ b/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml @@ -0,0 +1,45 @@ +name: Azure Static Web Apps CI/CD + +on: + push: + branches: + - deploy-demo + pull_request: + types: [opened, synchronize, reopened, closed] + branches: + - deploy-demo + +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@v2 + with: + submodules: true + - 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_POLITE_DESERT_00B80111E }} + 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: "/demo" # App source code path + api_location: "demo/api" # Api source code path - optional + output_location: "build/static" # 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_POLITE_DESERT_00B80111E }} + action: "close" From 872aca355024feec0749898102f52ebd5edadbff Mon Sep 17 00:00:00 2001 From: Geoff Rich <4992896+geoffrich@users.noreply.github.com> Date: Tue, 18 Oct 2022 15:58:27 -0700 Subject: [PATCH 2/7] Text change --- demo/src/routes/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/src/routes/+page.svelte b/demo/src/routes/+page.svelte index 97201ef3..2b1ed871 100644 --- a/demo/src/routes/+page.svelte +++ b/demo/src/routes/+page.svelte @@ -18,7 +18,7 @@ - to your new
SvelteKit app + to your new
SvelteKit app on Azure SWA

From d78f83375d5bece62937e1aa8cc6215dea1a061e Mon Sep 17 00:00:00 2001 From: Geoff Rich <4992896+geoffrich@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:00:46 -0700 Subject: [PATCH 3/7] Update workflow branch --- ...ure-static-web-apps-polite-desert-00b80111e.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml b/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml index 03a9249b..a34bb46a 100644 --- a/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml +++ b/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml @@ -3,11 +3,11 @@ name: Azure Static Web Apps CI/CD on: push: branches: - - deploy-demo + - main pull_request: types: [opened, synchronize, reopened, closed] branches: - - deploy-demo + - main jobs: build_and_deploy_job: @@ -24,12 +24,12 @@ jobs: with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_POLITE_DESERT_00B80111E }} repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) - action: "upload" + 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: "/demo" # App source code path - api_location: "demo/api" # Api source code path - optional - output_location: "build/static" # Built app content directory - optional + app_location: '/demo' # App source code path + api_location: 'demo/api' # Api source code path - optional + output_location: 'build/static' # Built app content directory - optional ###### End of Repository/Build Configurations ###### close_pull_request_job: @@ -42,4 +42,4 @@ jobs: uses: Azure/static-web-apps-deploy@v1 with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_POLITE_DESERT_00B80111E }} - action: "close" + action: 'close' From afaf1f070ce97c0435da71f3cbb9345a4927a44d Mon Sep 17 00:00:00 2001 From: Geoff Rich <4992896+geoffrich@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:03:26 -0700 Subject: [PATCH 4/7] Another text change --- demo/src/routes/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/src/routes/+page.svelte b/demo/src/routes/+page.svelte index 2b1ed871..97201ef3 100644 --- a/demo/src/routes/+page.svelte +++ b/demo/src/routes/+page.svelte @@ -18,7 +18,7 @@ - to your new
SvelteKit app on Azure SWA + to your new
SvelteKit app

From cbcc1e57587a88f318a194a54de7f65b585cfb3b Mon Sep 17 00:00:00 2001 From: Geoff Rich <4992896+geoffrich@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:11:34 -0700 Subject: [PATCH 5/7] Delete comment in workflow --- ...zure-static-web-apps-polite-desert-00b80111e.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml b/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml index a34bb46a..5b9175f5 100644 --- a/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml +++ b/.github/workflows/azure-static-web-apps-polite-desert-00b80111e.yml @@ -10,6 +10,19 @@ on: - main jobs: + clean: + if: github.event_name == 'pull_request' && github.event.action != 'closed' + runs-on: ubuntu-latest + name: Delete old bot comment + steps: + - name: pr-deleter + uses: maheshrayas/action-pr-comment-delete@06d7254b4aeba4491a66a7e0f755b107f7373ccd + with: + github_token: '${{ secrets.GITHUB_TOKEN }}' + org: 'geoffrich' + repo: 'svelte-adapter-azure-swa' + user: 'github-actions[bot]' + issue: '${{github.event.number}}' build_and_deploy_job: if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') runs-on: ubuntu-latest From 7b05d7fa48180560708a9a69d3cb4477d9d9ed3f Mon Sep 17 00:00:00 2001 From: Geoff Rich <4992896+geoffrich@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:19:14 -0700 Subject: [PATCH 6/7] docs: link deployed demo --- README.md | 4 ++-- demo/README.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4f228486..518551bf 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ Adapter for Svelte apps that creates an Azure Static Web App, using an Azure function for dynamic server rendering. If your app is purely static, you may be able to use [adapter-static](https://www.npmjs.com/package/@sveltejs/adapter-static) instead. -## Usage +See the [demo folder](https://github.com/geoffrich/svelte-adapter-azure-swa/tree/main/demo) for an example integration with the SvelteKit demo app. The demo is automatically deployed to [Azure SWA](https://polite-desert-00b80111e.2.azurestaticapps.net/) on every commit to `main`. -See the [demo folder](https://github.com/geoffrich/svelte-adapter-azure-swa/tree/main/demo) for an example integration with the SvelteKit demo app. +## Usage Run `npm install -D svelte-adapter-azure-swa`. diff --git a/demo/README.md b/demo/README.md index d4200572..aa1ede83 100644 --- a/demo/README.md +++ b/demo/README.md @@ -4,6 +4,8 @@ This is a repo demonstrating how to use [svelte-adapter-azure-swa](https://www.n This demo uses the local version of the adapter to make testing unreleased changes easier. In your app, you should install `svelte-adapter-azure-swa` from npm. +[Deployed demo](https://polite-desert-00b80111e.2.azurestaticapps.net/) + ## Developing Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: From 25b340474b0c075601d8413f5cc7ccb4e06bdb62 Mon Sep 17 00:00:00 2001 From: Geoff Rich <4992896+geoffrich@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:22:14 -0700 Subject: [PATCH 7/7] docs: tweak text --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 518551bf..9489050e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Adapter for Svelte apps that creates an Azure Static Web App, using an Azure function for dynamic server rendering. If your app is purely static, you may be able to use [adapter-static](https://www.npmjs.com/package/@sveltejs/adapter-static) instead. -See the [demo folder](https://github.com/geoffrich/svelte-adapter-azure-swa/tree/main/demo) for an example integration with the SvelteKit demo app. The demo is automatically deployed to [Azure SWA](https://polite-desert-00b80111e.2.azurestaticapps.net/) on every commit to `main`. +See the [demo folder](https://github.com/geoffrich/svelte-adapter-azure-swa/tree/main/demo) for an example integration with the SvelteKit demo app. The demo is automatically deployed to [Azure SWA](https://polite-desert-00b80111e.2.azurestaticapps.net/) on every commit to the main branch. ## Usage