From cd12d643fc4f8ee1b969afffd360b078d7902f2c Mon Sep 17 00:00:00 2001 From: "caofwsap;ifjcipelasifjoaeklf" <142117737+dedeahs4@users.noreply.github.com> Date: Sat, 16 Aug 2025 08:55:25 -0400 Subject: [PATCH 1/6] Update deploy.yml Fixed a error --- .github/workflows/deploy.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e65f829b5..324d3eb18 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,8 +1,9 @@ name: Deploy -# Define when the workflow should run +permissions: + id-token: write + on: - # Allow manual triggering of the workflow from the Actions tab workflow_dispatch: # Allow inputs to be passed when manually triggering the workflow from the Actions tab From 4f0a0db8dd4a6424ef890203777a31590f61e5c3 Mon Sep 17 00:00:00 2001 From: "caofwsap;ifjcipelasifjoaeklf" <142117737+dedeahs4@users.noreply.github.com> Date: Sat, 16 Aug 2025 08:58:38 -0400 Subject: [PATCH 2/6] Update deploy.yml --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 324d3eb18..1143ac978 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,6 +2,7 @@ name: Deploy permissions: id-token: write + contents: read on: workflow_dispatch: From 9bb0c664b81032efe235058c7cb4e60305e9dcfe Mon Sep 17 00:00:00 2001 From: "caofwsap;ifjcipelasifjoaeklf" <142117737+dedeahs4@users.noreply.github.com> Date: Sat, 16 Aug 2025 09:01:33 -0400 Subject: [PATCH 3/6] Update deploy.yml --- .github/workflows/deploy.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1143ac978..9c52104ad 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,6 +7,15 @@ permissions: on: workflow_dispatch: +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Echo deploy message + run: echo "Starting deployment..." # Allow inputs to be passed when manually triggering the workflow from the Actions tab inputs: DOCKERFILE_PATH: From 90be3846d680a051385f48ec10d49e0f4ebc0166 Mon Sep 17 00:00:00 2001 From: "caofwsap;ifjcipelasifjoaeklf" <142117737+dedeahs4@users.noreply.github.com> Date: Sat, 16 Aug 2025 09:06:26 -0400 Subject: [PATCH 4/6] Update deploy.yml --- .github/workflows/deploy.yml | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9c52104ad..dda2f161b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,21 +1,7 @@ name: Deploy -permissions: - id-token: write - contents: read - on: workflow_dispatch: - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Echo deploy message - run: echo "Starting deployment..." # Allow inputs to be passed when manually triggering the workflow from the Actions tab inputs: DOCKERFILE_PATH: @@ -51,7 +37,10 @@ jobs: GH_TOKEN: ${{ github.token }} # As required by the GitHub-CLI permissions: - actions: 'write' # Required in order to terminate the workflow run. + actions: 'write' + id-token: 'write' + contents: read + # Required in order to terminate the workflow run. steps: - uses: actions/checkout@v4 From ccf644d726d26009e1a12882d12f5dc1d3ec1887 Mon Sep 17 00:00:00 2001 From: "caofwsap;ifjcipelasifjoaeklf" <142117737+dedeahs4@users.noreply.github.com> Date: Sat, 16 Aug 2025 09:15:41 -0400 Subject: [PATCH 5/6] Update deploy.yml --- .github/workflows/deploy.yml | 75 +++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 26 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index dda2f161b..a9fed64ca 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,7 +2,6 @@ name: Deploy on: workflow_dispatch: - # Allow inputs to be passed when manually triggering the workflow from the Actions tab inputs: DOCKERFILE_PATH: type: string @@ -29,33 +28,57 @@ on: default: false jobs: - guard_clause: - runs-on: ubuntu-latest - - env: - GH_TOKEN: ${{ github.token }} # As required by the GitHub-CLI - - permissions: - actions: 'write' - id-token: 'write' - contents: read - # Required in order to terminate the workflow run. - - steps: - - uses: actions/checkout@v4 - # Guard clause that cancels the workflow in case of an invalid DOCKERFILE_PATH and/or incorrectly configured Github Pages. - # The main reason for choosing this workaround for aborting the workflow is the fact that it does not display the workflow as successful, which can set false expectations. - - name: DOCKERFILE_PATH. - shell: bash - run: | - # We check whether the Dockerfile_path is valid. - if [ ! -f ${{ github.event.inputs.DOCKERFILE_PATH }} ]; then - echo "::error title=Invalid Dockerfile path::No file found at ${{ github.event.inputs.DOCKERFILE_PATH }}" - echo "terminate=true" >> $GITHUB_ENV - fi + runs-on: ubuntu-latest + + env: + GH_TOKEN: ${{ github.token }} + + permissions: + actions: write + id-token: write + contents: read - - name: Github Pages config guard clause + steps: + - uses: actions/checkout@v4 + + - name: Validate Dockerfile path + shell: bash + run: | + if [ ! -f "${{ github.event.inputs.DOCKERFILE_PATH }}" ]; then + echo "::error title=Invalid Dockerfile path::No file found at ${{ github.event.inputs.DOCKERFILE_PATH }}" + echo "terminate=true" >> $GITHUB_ENV + fi + + - name: Github Pages config guard clause + if: ${{ github.event.inputs.DEPLOY_TO_GITHUB_PAGES == 'true' }} + run: | + set +e + gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${{ github.repository_owner }}/$(basename "${{ github.repository }}")/pages > pages_response + + if [ "$?" -ne 0 ]; then + echo "::error title=Potential pages configuration error::Please make sure GitHub Pages is enabled." + echo "terminate=true" >> $GITHUB_ENV + if + set -e + + if [[ "$(jq -r .build_type pages_response)" != "workflow" ]]; then + echo "::error title=Pages configuration error::Ensure GitHub Actions is selected as the deployment source." + echo "terminate=true" >> $GITHUB_ENV + if + rm pages_response + +-name: Terminate run if error occurred + run: | + if [[ "${{ env.terminate }}" == "true" ]]; then + gh run cancel "${{ github.run_id }}" + gh run watch "${{ github.run_id }}" + fi + + name: Github Pages config guard clause if: ${{ github.event.inputs.DEPLOY_TO_GITHUB_PAGES == 'true' }} run: | # We use the Github Rest api to get information regarding pages for the Github Repository and store it into a temporary file named "pages_response". From e10262db13ec244e5c252481196f0a0f95a5e24b Mon Sep 17 00:00:00 2001 From: "caofwsap;ifjcipelasifjoaeklf" <142117737+dedeahs4@users.noreply.github.com> Date: Sat, 16 Aug 2025 09:19:59 -0400 Subject: [PATCH 6/6] Update deploy.yml