From 2363700fa662f1808ebc10e21746fdc18c39f90a Mon Sep 17 00:00:00 2001 From: Justin Charles Date: Sat, 18 Jan 2025 13:56:18 +0530 Subject: [PATCH 1/7] CI/CD pipeline added for deployment Signed-off-by: Justin Charles --- .github/workflows/deploy.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000..e46cb30197 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Deploy + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + token: ${{ secrets.GH_TOKEN }} + + - name: Set up Git + run: | + git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git + git config --global user.name "GitHub Actions" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Deploy to GitHub Pages + run: | + git checkout gh-pages || git checkout --orphan gh-pages + # Make changes to gh-pages branch if necessary + git add . + git commit -m "Deploy updates" + git push origin gh-pages --force From 1440f3f21a40b039197c7b51622e2597ed96dd55 Mon Sep 17 00:00:00 2001 From: Justin Charles <143245796+justin212407@users.noreply.github.com> Date: Sat, 18 Jan 2025 13:58:46 +0530 Subject: [PATCH 2/7] Testing deploy.yml --- .github/workflows/deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e46cb30197..fde9ce3575 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,9 +4,11 @@ on: push: branches: - master + - deployment-pipeline-added pull_request: branches: - master + - deployment-pipeline-added workflow_dispatch: jobs: From 3a1d3b9dbd86b4fccd2065d0ad9afa90ca8a4983 Mon Sep 17 00:00:00 2001 From: Justin Charles <143245796+justin212407@users.noreply.github.com> Date: Sat, 18 Jan 2025 14:07:13 +0530 Subject: [PATCH 3/7] Removed testing code in deploy.yml --- .github/workflows/deploy.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fde9ce3575..ef8f2b4402 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,11 +4,9 @@ on: push: branches: - master - - deployment-pipeline-added pull_request: branches: - master - - deployment-pipeline-added workflow_dispatch: jobs: @@ -30,7 +28,6 @@ jobs: - name: Deploy to GitHub Pages run: | git checkout gh-pages || git checkout --orphan gh-pages - # Make changes to gh-pages branch if necessary git add . git commit -m "Deploy updates" git push origin gh-pages --force From 3639d3a28434999694c898c3a774160a9338eb27 Mon Sep 17 00:00:00 2001 From: Justin Charles <143245796+justin212407@users.noreply.github.com> Date: Wed, 22 Jan 2025 11:06:34 +0530 Subject: [PATCH 4/7] fixing token issues --- .github/workflows/deploy.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ef8f2b4402..325d16970c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,13 +15,13 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: - token: ${{ secrets.GH_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Set up Git run: | - git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git git config --global user.name "GitHub Actions" git config --global user.email "github-actions[bot]@users.noreply.github.com" @@ -29,5 +29,5 @@ jobs: run: | git checkout gh-pages || git checkout --orphan gh-pages git add . - git commit -m "Deploy updates" - git push origin gh-pages --force + git commit -m "Deploy updates" || echo "No changes to commit" + git push origin gh-pages From 082466f14cadc1855b5021749b8eba1b37a14660 Mon Sep 17 00:00:00 2001 From: Justin Charles <143245796+justin212407@users.noreply.github.com> Date: Thu, 23 Jan 2025 21:42:17 +0530 Subject: [PATCH 5/7] fixing deploy.yml --- .github/workflows/deploy.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 325d16970c..f42cb5b7c8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,7 +27,11 @@ jobs: - name: Deploy to GitHub Pages run: | - git checkout gh-pages || git checkout --orphan gh-pages + git fetch origin gh-pages || true + git checkout gh-pages 2>/dev/null || git checkout --orphan gh-pages + git rm -rf . > /dev/null 2>&1 || true + git clean -fxd + cp -r ../$(basename $GITHUB_WORKSPACE)/* . git add . - git commit -m "Deploy updates" || echo "No changes to commit" - git push origin gh-pages + git commit -m "Deploy updates from $(date)" || echo "No changes to commit" + git push origin gh-pages From ae3a16769b66a2ec3ff3535d3743ccc3fa233043 Mon Sep 17 00:00:00 2001 From: Justin Charles <143245796+justin212407@users.noreply.github.com> Date: Thu, 23 Jan 2025 21:46:36 +0530 Subject: [PATCH 6/7] Updating deploy.yml --- .github/workflows/deploy.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f42cb5b7c8..9ab8253e52 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,11 +27,12 @@ jobs: - name: Deploy to GitHub Pages run: | - git fetch origin gh-pages || true - git checkout gh-pages 2>/dev/null || git checkout --orphan gh-pages + mkdir -p deploy + cp -r * deploy + git checkout gh-pages || git checkout --orphan gh-pages git rm -rf . > /dev/null 2>&1 || true git clean -fxd - cp -r ../$(basename $GITHUB_WORKSPACE)/* . + cp -r deploy/* . git add . git commit -m "Deploy updates from $(date)" || echo "No changes to commit" git push origin gh-pages From 33881c3321ab649c1d75c6e6247bfd8a136db443 Mon Sep 17 00:00:00 2001 From: Justin Charles <143245796+justin212407@users.noreply.github.com> Date: Thu, 23 Jan 2025 21:52:33 +0530 Subject: [PATCH 7/7] Update deploy.yml --- .github/workflows/deploy.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9ab8253e52..fc96aa71f2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,12 +27,14 @@ jobs: - name: Deploy to GitHub Pages run: | - mkdir -p deploy - cp -r * deploy + mkdir -p ../deploy + cp -r * ../deploy/ git checkout gh-pages || git checkout --orphan gh-pages git rm -rf . > /dev/null 2>&1 || true git clean -fxd - cp -r deploy/* . + cp -r ../deploy/* . + rm -rf ../deploy git add . git commit -m "Deploy updates from $(date)" || echo "No changes to commit" git push origin gh-pages +