Skip to content

Commit

Permalink
Merge pull request #32 from rotty3000/main
Browse files Browse the repository at this point in the history
trigger gh pages publish workflow explicitly
  • Loading branch information
rotty3000 authored Jan 31, 2025
2 parents 6b7c9e9 + 0226d4b commit 13c67de
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/scripts/trigger_workflow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/bash

GH_TOKEN=${GH_TOKEN:-$(gh auth token)}
GIT_REPOSITORY=${GIT_REPOSITORY:-"LiferayCloud/liferay-helm-chart"}
PUBLISH_BRANCH=${PUBLISH_BRANCH:-"gh-pages"}
WORKFLOW_NAME=${WORKFLOW_NAME:-"Deploy GitHub Pages"}

WORKFLOW_ID=$(
curl -L -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${GIT_REPOSITORY}/actions/workflows \
| jq ".workflows[] | select(.name == \"${WORKFLOW_NAME}\") | .id"
)

curl -L -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${GIT_REPOSITORY}/actions/workflows/${WORKFLOW_ID}/dispatches \
--json '{"ref":"'${PUBLISH_BRANCH}'"}'
12 changes: 12 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,15 @@ jobs:
PUBLISH_BRANCH: gh-pages
REPO_URL: "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
REPOSITORY: ${{ github.event.repository.name }}

- name: Trigger Deploy GitHub Pages
if: ${{ env.PUBLISH == 'true' }}
run: |
sudo apt-get install -y jq
./.github/scripts/publish_helm_index.sh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_REPOSITORY: ${{ github.repository }}
PUBLISH_BRANCH: gh-pages
WORKFLOW_NAME: "Deploy GitHub Pages"

0 comments on commit 13c67de

Please sign in to comment.