From aae8225f59cb962776c875b94124d0c89d819273 Mon Sep 17 00:00:00 2001 From: benjaminparisel Date: Wed, 29 May 2024 15:06:15 +0200 Subject: [PATCH 1/2] ci: Use reusable workflow --- .github/workflows/build-pr-preview.yml | 23 ------------------- .github/workflows/pr-build-preview.yml | 18 +++++++++++++++ .../workflows/pr-comments-list-changes.yml | 16 +++++++++++++ .github/workflows/pr-deploy-preview.yml | 15 ++++++++++++ 4 files changed, 49 insertions(+), 23 deletions(-) delete mode 100644 .github/workflows/build-pr-preview.yml create mode 100644 .github/workflows/pr-build-preview.yml create mode 100644 .github/workflows/pr-comments-list-changes.yml create mode 100644 .github/workflows/pr-deploy-preview.yml diff --git a/.github/workflows/build-pr-preview.yml b/.github/workflows/build-pr-preview.yml deleted file mode 100644 index fe7eae5..0000000 --- a/.github/workflows/build-pr-preview.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Build PR preview - -on: - pull_request: - # To manage 'surge-preview' action teardown, add default event types + closed event type - types: [opened, synchronize, reopened, closed] - paths: - - 'modules/**' - - 'antora.yml' - - '.github/workflows/build-pr-preview.yml' -jobs: - build_preview: - runs-on: ubuntu-22.04 - permissions: - pull-requests: write # surge-preview write PR comments - steps: - - name: Build and publish PR preview - uses: bonitasoft/bonita-documentation-site/.github/actions/build-and-publish-pr-preview@master - with: - surge-token: ${{ secrets.SURGE_TOKEN_DOC }} - github-token: ${{ secrets.GITHUB_TOKEN }} - component-name: labs - fail-on-warning: true diff --git a/.github/workflows/pr-build-preview.yml b/.github/workflows/pr-build-preview.yml new file mode 100644 index 0000000..eb71430 --- /dev/null +++ b/.github/workflows/pr-build-preview.yml @@ -0,0 +1,18 @@ +name: Build PR preview + +on: + pull_request_target: + paths: + - 'modules/**' + - 'antora.yml' + - '.github/workflows/pr-build-preview.yml' + +jobs: + build: + permissions: + pull-requests: write # "pr-antora-content-guidelines-checker" write PR comments when the PR doesn't match the "Guidelines" + uses: bonitasoft/bonita-documentation-site/.github/workflows/_reusable_surge-build-preview.yml@master + secrets: inherit + with: + component-name: labs + fail-on-warning: true diff --git a/.github/workflows/pr-comments-list-changes.yml b/.github/workflows/pr-comments-list-changes.yml new file mode 100644 index 0000000..2bad594 --- /dev/null +++ b/.github/workflows/pr-comments-list-changes.yml @@ -0,0 +1,16 @@ +name: Comments PR with changes list + +on: + pull_request_target: + paths: + - '.github/workflows/pr-comments-list-changes.yml' + - 'modules/**' + +jobs: + site: + permissions: + pull-requests: write # write PR comments + uses: bonitasoft/bonita-documentation-site/.github/workflows/_reusable_pr-comment-list-changes.yml@master + secrets: inherit + with: + component-name: labs diff --git a/.github/workflows/pr-deploy-preview.yml b/.github/workflows/pr-deploy-preview.yml new file mode 100644 index 0000000..37cc879 --- /dev/null +++ b/.github/workflows/pr-deploy-preview.yml @@ -0,0 +1,15 @@ +name: Deploy PR preview + +on: + pull_request_target: + paths: + - 'modules/**' + - 'antora.yml' + - '.github/workflows/pr-build-preview.yml' + +jobs: + deploy: + permissions: + pull-requests: write + uses: bonitasoft/bonita-documentation-site/.github/workflows/_reusable_surge-deploy-preview.yml@master + secrets: inherit \ No newline at end of file From 0873f014f4a78c1e18fc54da085892d3d8363427 Mon Sep 17 00:00:00 2001 From: benjaminparisel Date: Wed, 29 May 2024 15:16:02 +0200 Subject: [PATCH 2/2] ci: run deploy on workflow_run event --- .github/workflows/pr-build-preview.yml | 4 +--- .github/workflows/pr-deploy-preview.yml | 11 ++++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-build-preview.yml b/.github/workflows/pr-build-preview.yml index eb71430..1736d06 100644 --- a/.github/workflows/pr-build-preview.yml +++ b/.github/workflows/pr-build-preview.yml @@ -1,7 +1,7 @@ name: Build PR preview on: - pull_request_target: + pull_request: paths: - 'modules/**' - 'antora.yml' @@ -9,8 +9,6 @@ on: jobs: build: - permissions: - pull-requests: write # "pr-antora-content-guidelines-checker" write PR comments when the PR doesn't match the "Guidelines" uses: bonitasoft/bonita-documentation-site/.github/workflows/_reusable_surge-build-preview.yml@master secrets: inherit with: diff --git a/.github/workflows/pr-deploy-preview.yml b/.github/workflows/pr-deploy-preview.yml index 37cc879..f308020 100644 --- a/.github/workflows/pr-deploy-preview.yml +++ b/.github/workflows/pr-deploy-preview.yml @@ -1,11 +1,12 @@ name: Deploy PR preview + on: - pull_request_target: - paths: - - 'modules/**' - - 'antora.yml' - - '.github/workflows/pr-build-preview.yml' + workflow_run: + workflows: + - "Build PR preview" + types: + - completed jobs: deploy: