From 3c14503a2b984b664a6355713ef231057442a08a Mon Sep 17 00:00:00 2001 From: coder12git Date: Sat, 4 Nov 2023 11:11:36 +0530 Subject: [PATCH 1/4] feat(core): workflows for deployment Signed-off-by: coder12git --- .github/workflows/build-and-deploy-site.yml | 28 ++++++++++++ .github/workflows/build-and-preview-site.yml | 34 +++++++++++++++ .github/workflows/preview-site.yml | 46 ++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 .github/workflows/build-and-deploy-site.yml create mode 100644 .github/workflows/build-and-preview-site.yml create mode 100644 .github/workflows/preview-site.yml diff --git a/.github/workflows/build-and-deploy-site.yml b/.github/workflows/build-and-deploy-site.yml new file mode 100644 index 000000000..3c9b5fdc2 --- /dev/null +++ b/.github/workflows/build-and-deploy-site.yml @@ -0,0 +1,28 @@ +name: Build and Deploy Site +on: + push: + branches: [ master ] + paths: + - '!**' + - 'site/**' +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@master + with: + fetch-depth: 1 + + - name: Install and Build 🔧 + run: | + cd site + npm install + npm run build + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@4.0.0 + with: + branch: master # The branch the action should deploy to. + folder: public # The folder the action should deploy. + clean: true \ No newline at end of file diff --git a/.github/workflows/build-and-preview-site.yml b/.github/workflows/build-and-preview-site.yml new file mode 100644 index 000000000..f07fe1ec3 --- /dev/null +++ b/.github/workflows/build-and-preview-site.yml @@ -0,0 +1,34 @@ +name: Build and Preview Site +on: + pull_request: + branches: [ master ] + types: [opened, synchronize, reopened] + paths: + - '!**' + - 'site/**' + +jobs: + site-preview: + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@master + with: + persist-credentials: false + fetch-depth: 1 + + - name: Install and Build 🔧 + run: | + cd site + npm install + npm run noIndex + - name: Zip Site + run: bash site/script.sh + - name: Upload files + uses: actions/upload-artifact@master + with: + name: public-dir + path: ./public-dir.zip + retention-days: 1 + - name: Triger Inner workflow + run: echo "trigering inner workflow" \ No newline at end of file diff --git a/.github/workflows/preview-site.yml b/.github/workflows/preview-site.yml new file mode 100644 index 000000000..c784607ea --- /dev/null +++ b/.github/workflows/preview-site.yml @@ -0,0 +1,46 @@ +name: Deploy Preview +on: + workflow_run: + workflows: + - Build and Preview Site + types: + - completed + +jobs: + deploy-preview: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2.3.1 + + - name: Download Site dir + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{ secrets.GH_ACCESS_TOKEN }} + workflow: build-and-preview-site.yml + run_id: ${{ github.event.workflow_run.id }} + name: public-dir + + - name: Unzip Site + run: | + rm -rf ./site/public + unzip public-dir.zip + rm -f public-dir.zip + + - name: Deploy to Netlify + id: netlify + uses: nwtgck/actions-netlify@v1.1 + with: + publish-dir: 'site/public' + production-deploy: false + github-token: ${{ secrets.GH_ACCESS_TOKEN }} + enable-commit-comment: false + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + + - name: Comment Deploy URL + uses: ./.github/actions/comment-preview-on-pr + with: + token: ${{ secrets.GH_ACCESS_TOKEN }} + deploy_url: "${{ steps.netlify.outputs.deploy-url }}" \ No newline at end of file From 84d0d8a54067d946291d92bdbda4befa85e672ee Mon Sep 17 00:00:00 2001 From: Suruchi Kumari Date: Sat, 4 Nov 2023 15:24:50 +0530 Subject: [PATCH 2/4] Update build-and-deploy-site.yml Signed-off-by: Suruchi Kumari --- .github/workflows/build-and-deploy-site.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy-site.yml b/.github/workflows/build-and-deploy-site.yml index 3c9b5fdc2..b471f04a7 100644 --- a/.github/workflows/build-and-deploy-site.yml +++ b/.github/workflows/build-and-deploy-site.yml @@ -24,5 +24,5 @@ jobs: uses: JamesIves/github-pages-deploy-action@4.0.0 with: branch: master # The branch the action should deploy to. - folder: public # The folder the action should deploy. - clean: true \ No newline at end of file + folder: site/public # The folder the action should deploy. + clean: true From f3f571aef90df7216473995dd3d7bb2c1bf845ff Mon Sep 17 00:00:00 2001 From: Suruchi Kumari Date: Sat, 4 Nov 2023 23:36:05 +0530 Subject: [PATCH 3/4] fix-syntax-err Signed-off-by: Suruchi Kumari --- .github/workflows/build-and-preview-site.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-preview-site.yml b/.github/workflows/build-and-preview-site.yml index f07fe1ec3..f818fe941 100644 --- a/.github/workflows/build-and-preview-site.yml +++ b/.github/workflows/build-and-preview-site.yml @@ -20,8 +20,8 @@ jobs: - name: Install and Build 🔧 run: | cd site - npm install - npm run noIndex + npm install + npm run noIndex - name: Zip Site run: bash site/script.sh - name: Upload files @@ -31,4 +31,4 @@ jobs: path: ./public-dir.zip retention-days: 1 - name: Triger Inner workflow - run: echo "trigering inner workflow" \ No newline at end of file + run: echo "trigering inner workflow" From 2c0793c5f30167e79358a0b8bac559c55fcd5e19 Mon Sep 17 00:00:00 2001 From: Lee Calcote Date: Sun, 5 Nov 2023 10:12:57 -0600 Subject: [PATCH 4/4] Update .github/workflows/build-and-deploy-site.yml Signed-off-by: Lee Calcote --- .github/workflows/build-and-deploy-site.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy-site.yml b/.github/workflows/build-and-deploy-site.yml index b471f04a7..76ace81fb 100644 --- a/.github/workflows/build-and-deploy-site.yml +++ b/.github/workflows/build-and-deploy-site.yml @@ -23,6 +23,6 @@ jobs: - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@4.0.0 with: - branch: master # The branch the action should deploy to. - folder: site/public # The folder the action should deploy. + branch: site # The branch the action should deploy to. + folder: public # The folder the action should deploy. clean: true