From 67bdfa92f6002c244e14fbc12e9bacb38b234a99 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Fri, 6 Oct 2023 20:01:51 +0530 Subject: [PATCH 01/18] Create main.yml --- .github/workflows/main.yml | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..d61eb44 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,43 @@ +name: Deploy website + +on: + push: + branches: + - main + +jobs: + build-and-deploy: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Node.js(18.17.1) + uses: actions/setup-node@v3 + with: + node-version: 18.17.1 + + - name: Build website + run: | + yarn install + yarn run build + name: Deployment + + Deploy: + needs: build-and-deploy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALSS }} + + - name: Upload to blob storage + uses: azure/CLI@v1 + with: + inlineScript: | + az storage blob upload-batch --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key --overwrite -d '$web' -s . + # Azure logout + - name: logout + run: | + az logout + if: always() From 3154ea556f2fa890698c69e2095bdb2c0f8e003d Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Fri, 6 Oct 2023 20:08:27 +0530 Subject: [PATCH 02/18] Update main.yml --- .github/workflows/main.yml | 55 +++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d61eb44..cfc98ce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,29 +1,52 @@ -name: Deploy website +# Continuous Integration workflow to: +# 1. Build, lint, and test project +# 2. Commit any updates to "dist" folder on: push: - branches: - - main + branches: + - main + pull_request: + +name: Continuous Integration jobs: - build-and-deploy: - name: Build + build: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v3 - - name: Install Node.js(18.17.1) - uses: actions/setup-node@v3 + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 with: - node-version: 18.17.1 - - - name: Build website - run: | - yarn install - yarn run build - name: Deployment + node-version: '12' + + - run: npm install + + - run: npm run build + + - run: npm run lint + + - run: npm run test + + - name: Examine changes + run: |- + echo 'FILES_CHANGED<> $GITHUB_ENV + git diff --exit-code dist/index.js >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + + - name: Update dist + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && env.FILES_CHANGED }} + uses: swinton/commit@v2.x + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: + dist/index.js + commit-message: Update dist Deploy: - needs: build-and-deploy + needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 425744855357c6e3e1e3694e1007e8a4924ce15f Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Fri, 6 Oct 2023 20:19:39 +0530 Subject: [PATCH 03/18] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cfc98ce..77c6c56 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,7 +52,7 @@ jobs: - uses: actions/checkout@v3 - uses: azure/login@v1 with: - creds: ${{ secrets.AZURE_CREDENTIALSS }} + creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Upload to blob storage uses: azure/CLI@v1 From f9b508b2d574a2534f7f57a3987d86493d7c4c52 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Mon, 9 Oct 2023 16:21:31 +0530 Subject: [PATCH 04/18] Update main.yml From b3d6196680e840011ab161a880c34f1a10a3bcd6 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Mon, 9 Oct 2023 19:37:23 +0530 Subject: [PATCH 05/18] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 77c6c56..5beff44 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,7 +55,7 @@ jobs: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Upload to blob storage - uses: azure/CLI@v1 + uses: Azure/cli@1.0.4 with: inlineScript: | az storage blob upload-batch --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key --overwrite -d '$web' -s . From a315ef59585ee14cc30bb61e6b6b74fcd57bae82 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Mon, 9 Oct 2023 19:42:46 +0530 Subject: [PATCH 06/18] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5beff44..d453905 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,7 +58,7 @@ jobs: uses: Azure/cli@1.0.4 with: inlineScript: | - az storage blob upload-batch --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key --overwrite -d '$web' -s . + az storage blob upload-batch -d '$web' -s --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key --overwrite . # Azure logout - name: logout run: | From e9b998f09394e16852a4b632f40ef17ef535fb52 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Mon, 9 Oct 2023 19:47:28 +0530 Subject: [PATCH 07/18] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d453905..7f0c963 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,8 +58,8 @@ jobs: uses: Azure/cli@1.0.4 with: inlineScript: | - az storage blob upload-batch -d '$web' -s --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key --overwrite . - # Azure logout + az storage blob upload-batch -d '$web' -s . --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key --overwrite + # Azure logout - name: logout run: | az logout From 13e6d5fc2fcbd57fbfbc4d1ddfa70b078570550b Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Mon, 9 Oct 2023 19:56:37 +0530 Subject: [PATCH 08/18] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7f0c963..8e35a55 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,7 +58,7 @@ jobs: uses: Azure/cli@1.0.4 with: inlineScript: | - az storage blob upload-batch -d '$web' -s . --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key --overwrite + az storage blob upload-batch -d '$web' -s . --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key # Azure logout - name: logout run: | From 104f506fd44e479cb79cb02b1155de7d3e29920e Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Mon, 9 Oct 2023 20:13:08 +0530 Subject: [PATCH 09/18] Update main.yml --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8e35a55..af55624 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,7 +58,9 @@ jobs: uses: Azure/cli@1.0.4 with: inlineScript: | - az storage blob upload-batch -d '$web' -s . --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key + whereis az + az storage blob copy --source-container . --source-blob . --destination-container '$web' --destination-blob statichostingwebs + # az storage blob upload-batch -d '$web' -s . --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key # Azure logout - name: logout run: | From 4dd25c9c4761144003fc619813c4e782a7433b8d Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Mon, 9 Oct 2023 20:19:10 +0530 Subject: [PATCH 10/18] Update main.yml --- .github/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af55624..9ab9c8f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,9 +57,8 @@ jobs: - name: Upload to blob storage uses: Azure/cli@1.0.4 with: - inlineScript: | - whereis az - az storage blob copy --source-container . --source-blob . --destination-container '$web' --destination-blob statichostingwebs + inlineScript: + az storage blob copy -s . --destination-container '$web' --destination-blob statichostingwebs # az storage blob upload-batch -d '$web' -s . --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key # Azure logout - name: logout From 6143c356e1bc8b577eb86ac11cfb556d6c01df61 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Mon, 9 Oct 2023 20:21:49 +0530 Subject: [PATCH 11/18] Update main.yml --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9ab9c8f..90ee680 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,6 +2,7 @@ # 1. Build, lint, and test project # 2. Commit any updates to "dist" folder + on: push: branches: From 519a3201ea5a5293762ae339d3e93e38bd9dd2c3 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:16:41 +0530 Subject: [PATCH 12/18] Update main.yml --- .github/workflows/main.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90ee680..528df3c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,6 +25,7 @@ jobs: - run: npm install - run: npm run build + - run: mkdir dist - run: npm run lint @@ -45,7 +46,6 @@ jobs: files: dist/index.js commit-message: Update dist - Deploy: needs: build runs-on: ubuntu-latest @@ -58,10 +58,9 @@ jobs: - name: Upload to blob storage uses: Azure/cli@1.0.4 with: - inlineScript: - az storage blob copy -s . --destination-container '$web' --destination-blob statichostingwebs - # az storage blob upload-batch -d '$web' -s . --account-name statichostingwebs --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key - # Azure logout + inlineScript: | + az storage blob upload-batch --account-name statichostingwebs -d '$web' -s dist/ + - name: logout run: | az logout From 5f490021ddf1a8309f8f24c07f9aea4ef41e16a0 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:19:28 +0530 Subject: [PATCH 13/18] Update ci.yml --- .github/workflows/ci.yml | 45 ---------------------------------------- 1 file changed, 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18b6b57..8b13789 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,46 +1 @@ -# Continuous Integration workflow to: -# 1. Build, lint, and test project -# 2. Commit any updates to "dist" folder -on: - push: - branches: - - main - pull_request: - -name: Continuous Integration - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-node@v2 - with: - node-version: '12' - - - run: npm install - - - run: npm run build - - - run: npm run lint - - - run: npm run test - - - name: Examine changes - run: |- - echo 'FILES_CHANGED<> $GITHUB_ENV - git diff --exit-code dist/index.js >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV - - - name: Update dist - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && env.FILES_CHANGED }} - uses: swinton/commit@v2.x - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - files: - dist/index.js - commit-message: Update dist \ No newline at end of file From adff0879ce26311242a9ae99cc2aee30f22a12a6 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:19:50 +0530 Subject: [PATCH 14/18] Update main.yml --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 528df3c..6a4556f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,8 +25,7 @@ jobs: - run: npm install - run: npm run build - - run: mkdir dist - + - run: npm run lint - run: npm run test From 63cb9e00406b18d92fd1bf7e8d1d331a342f6c55 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:33:46 +0530 Subject: [PATCH 15/18] Update ci.yml --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b13789..f568e72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1 +1,56 @@ +on: + push: + branches: + - main + pull_request: + +name: Continuous Integration + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: '12' + + - run: npm install + + - run: npm run build + + - run: npm run lint + + - run: npm run test + + - name: Upload build artifacts to artifact store + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: dist + + Deploy: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Download build artifacts from artifact store + uses: actions/download-artifact@v3 + with: + name: build-artifacts + path: dist + + - name: Upload to blob storage + uses: Azure/cli@1.0.4 + with: + inlineScript: | + az storage blob upload-batch --account-name statichostingwebs -d '$web' -s dist/ + + - name: logout + run: | + az logout + if: always() From 3793ef70a185fc1658d4b8ef6f4e2d7c5062df8b Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Fri, 13 Oct 2023 17:25:14 +0530 Subject: [PATCH 16/18] Update and rename main.yml to dev.yml --- .github/workflows/{main.yml => dev.yml} | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) rename .github/workflows/{main.yml => dev.yml} (72%) diff --git a/.github/workflows/main.yml b/.github/workflows/dev.yml similarity index 72% rename from .github/workflows/main.yml rename to .github/workflows/dev.yml index 6a4556f..a224f0a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/dev.yml @@ -1,16 +1,6 @@ -# Continuous Integration workflow to: -# 1. Build, lint, and test project -# 2. Commit any updates to "dist" folder - - +name: tester on: - push: - branches: - - main - pull_request: - -name: Continuous Integration - + workflow_dispatch: jobs: build: runs-on: ubuntu-latest @@ -58,8 +48,13 @@ jobs: uses: Azure/cli@1.0.4 with: inlineScript: | - az storage blob upload-batch --account-name statichostingwebs -d '$web' -s dist/ + az storage blob upload-batch --account-name staticcontent1 --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key --overwrite -d '$web' -s dist/ + - name: Purge CDN endpoint + uses: azure/CLI@v1 + with: + inlineScript: | + az cdn endpoint purge --content-paths "/*" --profile-name "staticwebsite" --name "staticwebsite123" --resource-group "tester" - name: logout run: | az logout From cd7a5bd7b28fbfded75e56d6662346193ac99f0a Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:07:38 +0530 Subject: [PATCH 17/18] Update dev.yml --- .github/workflows/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index a224f0a..96e9c5a 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -1,4 +1,4 @@ -name: tester +name: testerabc on: workflow_dispatch: jobs: From 54543a56ccb6f69e71439eb9c32fa6a38c495710 Mon Sep 17 00:00:00 2001 From: ankit8389 <147081106+ankit8389@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:08:58 +0530 Subject: [PATCH 18/18] Update dev.yml --- .github/workflows/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 96e9c5a..45b01de 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -1,4 +1,4 @@ -name: testerabc +name: Build & Deploy on: workflow_dispatch: jobs: