From d8468b88e96a07f1ad642c0f9b623ba5708c72f0 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Fri, 16 Feb 2024 17:52:37 -0300 Subject: [PATCH 1/9] Fix #537 - Add surge.sh preview GHA Signed-off-by: Ricardo Zanini --- .github/workflows/jenkins-tests-PR.yml | 18 +++--- .github/workflows/npm-publish-pages.yml | 52 ++++++++-------- .github/workflows/pr-backporting.yml | 6 +- .github/workflows/pr-preview-teardown.yml | 43 ++++++++++++++ .github/workflows/pr-preview.yml | 72 +++++++++++++++++++++++ .github/workflows/sw-docs-pr.yml | 14 +++-- antora-playbook-author.yml | 3 + antora-playbook.yml | 2 + 8 files changed, 165 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/pr-preview-teardown.yml create mode 100644 .github/workflows/pr-preview.yml diff --git a/.github/workflows/jenkins-tests-PR.yml b/.github/workflows/jenkins-tests-PR.yml index 879dfc43a..7277c84cc 100644 --- a/.github/workflows/jenkins-tests-PR.yml +++ b/.github/workflows/jenkins-tests-PR.yml @@ -22,9 +22,9 @@ name: Jenkins Tests on: pull_request: - paths: - - '.ci/jenkins/**' - - '.github/workflows/jenkins-tests-PR.yml' + paths: + - ".ci/jenkins/**" + - ".github/workflows/jenkins-tests-PR.yml" jobs: dsl-tests: @@ -33,9 +33,9 @@ jobs: cancel-in-progress: true runs-on: ubuntu-latest steps: - - name: DSL tests - uses: kiegroup/kie-ci/.ci/actions/dsl-tests@main - with: - main-config-file-repo: apache/incubator-kie-kogito-pipelines - main-config-file-path: .ci/jenkins/config/main.yaml - branch-config-file-repo: apache/incubator-kie-kogito-pipelines + - name: DSL tests + uses: kiegroup/kie-ci/.ci/actions/dsl-tests@main + with: + main-config-file-repo: apache/incubator-kie-kogito-pipelines + main-config-file-path: .ci/jenkins/config/main.yaml + branch-config-file-repo: apache/incubator-kie-kogito-pipelines diff --git a/.github/workflows/npm-publish-pages.yml b/.github/workflows/npm-publish-pages.yml index 43d01dc4e..7a15dd7ac 100644 --- a/.github/workflows/npm-publish-pages.yml +++ b/.github/workflows/npm-publish-pages.yml @@ -20,7 +20,7 @@ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages -name: Node.js Publish webpage +name: Node.js Publish SonataFlow Docs on: push: @@ -34,7 +34,6 @@ permissions: jobs: build: - runs-on: ubuntu-latest strategy: @@ -43,30 +42,29 @@ jobs: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - name: Checkout main branch - uses: actions/checkout@v3 - with: - ref: main - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} -# cache: 'npm' + - name: Checkout main branch + uses: actions/checkout@v3 + with: + ref: main + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Build the pages + run: npm run install-build + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" - - name: Build the pages - run: npm run install-build + - name: Copy latest to numbered version + run: python scripts/copy-latest.py - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Copy latest to numbered version - run: python scripts/copy-latest.py - - - name: Publish to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: build/site + - name: Publish to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: build/site diff --git a/.github/workflows/pr-backporting.yml b/.github/workflows/pr-backporting.yml index 899e108d3..d9c31c9de 100644 --- a/.github/workflows/pr-backporting.yml +++ b/.github/workflows/pr-backporting.yml @@ -39,14 +39,14 @@ jobs: uses: kiegroup/kie-ci/.ci/actions/parse-labels@main with: labels: ${LABELS} - + backporting: if: ${{ github.event.pull_request.state == 'closed' && github.event.pull_request.merged && needs.compute-targets.outputs.target-branches != '[]' }} name: "[${{ matrix.target-branch }}] - Backporting" runs-on: ubuntu-latest needs: compute-targets strategy: - matrix: + matrix: target-branch: ${{ fromJSON(needs.compute-targets.outputs.target-branches) }} fail-fast: false env: @@ -56,4 +56,4 @@ jobs: uses: kiegroup/kie-ci/.ci/actions/backporting@main with: target-branch: ${{ matrix.target-branch }} - additional-reviewers: ${REVIEWERS} \ No newline at end of file + additional-reviewers: ${REVIEWERS} diff --git a/.github/workflows/pr-preview-teardown.yml b/.github/workflows/pr-preview-teardown.yml new file mode 100644 index 000000000..5f04a7246 --- /dev/null +++ b/.github/workflows/pr-preview-teardown.yml @@ -0,0 +1,43 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: SonataFlow Guides Preview Teardown + +on: + pull_request_target: + paths: + - "*.adoc" + types: [closed] + +jobs: + preview-teardown: + runs-on: ubuntu-latest + steps: + - name: Teardown surge preview + id: deploy + run: npx surge teardown https://sonataflow-docs-preview-pr-${{ github.event.number }}.surge.sh --token ${{ secrets.SURGE_TOKEN }} + - name: Update PR status comment + uses: actions-cool/maintain-one-comment@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + 🙈 The PR is closed and the preview is expired. + + body-include: "" + number: ${{ github.event.number }} diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml new file mode 100644 index 000000000..5d2a4b316 --- /dev/null +++ b/.github/workflows/pr-preview.yml @@ -0,0 +1,72 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: SonataFlow Guides Preview + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + branches: [main] + paths-ignore: + - ".gitignore" + - "LICENSE" + - "README*" + - "CONTRIBUTING.md" +jobs: + build_site: + name: "Building SonataFlow Docs with Antora" + runs-on: [ubuntu-latest] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "16" + - run: export DOCSEARCH_ENABLED=true + - run: export DOCSEARCH_ENGINE=lunr + - run: export NODE_PATH="$(npm -g root)" + - run: npm -v + - run: npm run local-install-build + + - name: Publishing to surge for preview + id: deploy + run: npx surge ./build/site --domain https://sonataflow-docs-preview-pr-${{ steps.pr.outputs.id }}.surge.sh --token ${{ secrets.SURGE_LOCAL_TOKEN }} + + - name: Update PR status comment on success + uses: actions-cool/maintain-one-comment@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + 🎊 PR Preview ${{ github.sha }} has been successfully built and deployed. See the documentation preview: https://sonataflow-docs-preview-pr-${{ steps.pr.outputs.id }}.surge.sh + + body-include: "" + number: ${{ steps.pr.outputs.id }} + emojis: "heart" + + - name: Update PR status comment on failure + if: ${{ failure() }} + uses: actions-cool/maintain-one-comment@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + 😭 Deploy PR Preview failed. + + + body-include: "" + number: ${{ steps.pr.outputs.id }} + emojis: "confused" diff --git a/.github/workflows/sw-docs-pr.yml b/.github/workflows/sw-docs-pr.yml index 469a3394f..6dba43044 100644 --- a/.github/workflows/sw-docs-pr.yml +++ b/.github/workflows/sw-docs-pr.yml @@ -17,27 +17,29 @@ # under the License. # -name: SonataFlow Guides +name: SonataFlow Guides Build on: pull_request: types: [opened, synchronize, reopened, ready_for_review] branches: [main] paths-ignore: - - '.gitignore' - - 'LICENSE' - - 'README*' + - ".gitignore" + - "LICENSE" + - "README*" + - "CONTRIBUTING.md" jobs: build_site: - name: "Building SonataFlow Guides with Antora" + name: "Building SonataFlow Docs with Antora" runs-on: [ubuntu-latest] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16' + node-version: "16" - run: export DOCSEARCH_ENABLED=true - run: export DOCSEARCH_ENGINE=lunr - run: export NODE_PATH="$(npm -g root)" - run: npm -v + # TODO: fail if warning - run: npm run install-build diff --git a/antora-playbook-author.yml b/antora-playbook-author.yml index c07423799..a2a26cc94 100644 --- a/antora-playbook-author.yml +++ b/antora-playbook-author.yml @@ -31,6 +31,9 @@ content: - url: . branches: HEAD start_path: serverlessworkflow +runtime: + log: + failure_level: warn ui: bundle: url: ./antora/ui-bundle.zip diff --git a/antora-playbook.yml b/antora-playbook.yml index 3d2741328..1c58097b3 100644 --- a/antora-playbook.yml +++ b/antora-playbook.yml @@ -37,6 +37,8 @@ content: start_path: serverlessworkflow runtime: fetch: true + log: + failure_level: warn ui: bundle: url: ./antora/ui-bundle.zip From 93a7cde5443064bf3a0c038ec69d1996adddff28 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Fri, 16 Feb 2024 18:02:17 -0300 Subject: [PATCH 2/9] Removing log level failure on default playbook Signed-off-by: Ricardo Zanini --- .github/workflows/sw-docs-pr.yml | 3 +-- antora-playbook.yml | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/sw-docs-pr.yml b/.github/workflows/sw-docs-pr.yml index 6dba43044..c32cc5773 100644 --- a/.github/workflows/sw-docs-pr.yml +++ b/.github/workflows/sw-docs-pr.yml @@ -41,5 +41,4 @@ jobs: - run: export DOCSEARCH_ENGINE=lunr - run: export NODE_PATH="$(npm -g root)" - run: npm -v - # TODO: fail if warning - - run: npm run install-build + - run: npm run local-install-build diff --git a/antora-playbook.yml b/antora-playbook.yml index 1c58097b3..3d2741328 100644 --- a/antora-playbook.yml +++ b/antora-playbook.yml @@ -37,8 +37,6 @@ content: start_path: serverlessworkflow runtime: fetch: true - log: - failure_level: warn ui: bundle: url: ./antora/ui-bundle.zip From 8dfddf795341dfff3a0c9122ee53ab487c2ea164 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Thu, 22 Feb 2024 12:11:37 -0300 Subject: [PATCH 3/9] Fix Jenkins GHA Signed-off-by: Ricardo Zanini --- .github/workflows/jenkins-tests-PR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jenkins-tests-PR.yml b/.github/workflows/jenkins-tests-PR.yml index 7277c84cc..dac4f93eb 100644 --- a/.github/workflows/jenkins-tests-PR.yml +++ b/.github/workflows/jenkins-tests-PR.yml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest steps: - name: DSL tests - uses: kiegroup/kie-ci/.ci/actions/dsl-tests@main + uses: apache/incubator-kie-kogito-pipelines/.ci/actions/dsl-tests@main with: main-config-file-repo: apache/incubator-kie-kogito-pipelines main-config-file-path: .ci/jenkins/config/main.yaml From 608d8ec9d1a7843c7e13bd51a6c4180e860a227a Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Mon, 26 Feb 2024 17:04:21 -0300 Subject: [PATCH 4/9] Fix custom-functions-support vars Signed-off-by: Ricardo Zanini --- .../modules/ROOT/pages/core/custom-functions-support.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc b/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc index bd53207cb..6bbbee125 100644 --- a/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc +++ b/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc @@ -556,10 +556,10 @@ The following example shows the declaration of a `rest` function: <1> `multiplyAllAndSum` is the function name <2> `custom` is the function type -<3> `rest:post:/numbers/{multiplier}/multiplyByAndSum` is the custom operation definition. In the custom operation definition: +<3> `rest:post:/numbers/\{multiplier}/multiplyByAndSum` is the custom operation definition. In the custom operation definition: * `rest` is the reserved operation keyword that indicates this is a REST call. * `post` is the HTTP method. -* `/numbers/{multiplier}/multiplyByAndSum` is the relative endpoint. +* `/numbers/\{multiplier}/multiplyByAndSum` is the relative endpoint. When using the relative endpoints you must specify the host as a property. The format of the host property is `kogito.sw.functions..host`. Therefore, in this example, `kogito.sw.functions.multiplyAllByAndSum.host` is the host property key. You might override the default port (80) if needed by specifying `kogito.sw.functions.multiplyAllAndSum.port` property. @@ -599,7 +599,7 @@ For example, given the following function definition that performs a `get` reque } ---- -You can replace `{category}` specifying an argument with that name, plus adding `sort` query parameter +You can replace `\{category}` specifying an argument with that name, plus adding `sort` query parameter .Example of a `get` request invocation From 959238ff9a3ce7d13dcc6b6a52a5c601596a8e9c Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Wed, 6 Mar 2024 13:02:33 -0300 Subject: [PATCH 5/9] Changes preview to pull_request_target Signed-off-by: Ricardo Zanini --- .github/workflows/pr-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 5d2a4b316..7204407f8 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -20,7 +20,7 @@ name: SonataFlow Guides Preview on: - pull_request: + pull_request_target: types: [opened, synchronize, reopened, ready_for_review] branches: [main] paths-ignore: From 881282842864de8c944acdfc7ed6a7479e372834 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Wed, 6 Mar 2024 13:17:56 -0300 Subject: [PATCH 6/9] :robot: Incorporate AI suggestions Signed-off-by: Ricardo Zanini --- .github/workflows/pr-preview.yml | 63 ++++++++++++++------------------ 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 7204407f8..05e499ca9 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -1,65 +1,58 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - name: SonataFlow Guides Preview on: pull_request_target: - types: [opened, synchronize, reopened, ready_for_review] + types: [opened, synchronize, reopened, ready_for_review, edited] branches: [main] paths-ignore: - ".gitignore" - "LICENSE" - "README*" - "CONTRIBUTING.md" + jobs: build_site: name: "Building SonataFlow Docs with Antora" - runs-on: [ubuntu-latest] + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 with: node-version: "16" - - run: export DOCSEARCH_ENABLED=true - - run: export DOCSEARCH_ENGINE=lunr - - run: export NODE_PATH="$(npm -g root)" - - run: npm -v - - run: npm run local-install-build - - - name: Publishing to surge for preview + + - name: Set environment variables + run: | + echo "DOCSEARCH_ENABLED=true" >> $GITHUB_ENV + echo "DOCSEARCH_ENGINE=lunr" >> $GITHUB_ENV + echo "NODE_PATH=$(npm -g root)" >> $GITHUB_ENV + + - name: Check Node.js version + run: npm -v + + - name: Install dependencies and build + run: npm run local-install-build + + - name: Publish to Surge for preview id: deploy - run: npx surge ./build/site --domain https://sonataflow-docs-preview-pr-${{ steps.pr.outputs.id }}.surge.sh --token ${{ secrets.SURGE_LOCAL_TOKEN }} + run: npx surge ./build/site --domain https://sonataflow-docs-preview-pr-${{ github.event.number }}.surge.sh --token ${{ secrets.SURGE_LOCAL_TOKEN }} - name: Update PR status comment on success + if: success() uses: actions-cool/maintain-one-comment@v3 with: token: ${{ secrets.GITHUB_TOKEN }} body: | - 🎊 PR Preview ${{ github.sha }} has been successfully built and deployed. See the documentation preview: https://sonataflow-docs-preview-pr-${{ steps.pr.outputs.id }}.surge.sh + 🎊 PR Preview ${{ github.sha }} has been successfully built and deployed. See the documentation preview: https://sonataflow-docs-preview-pr-${{ github.event.number }}.surge.sh body-include: "" - number: ${{ steps.pr.outputs.id }} + number: ${{ github.event.number }} emojis: "heart" - name: Update PR status comment on failure - if: ${{ failure() }} + if: failure() uses: actions-cool/maintain-one-comment@v3 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -68,5 +61,5 @@ jobs: body-include: "" - number: ${{ steps.pr.outputs.id }} + number: ${{ github.event.number }} emojis: "confused" From 6e5b1ccad6a164fecd1ae9168f446ba1bf0be289 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Wed, 6 Mar 2024 13:54:02 -0300 Subject: [PATCH 7/9] Break preview in two stages in order to use secrets Signed-off-by: Ricardo Zanini --- .github/workflows/pr-preview-build.yml | 62 +++++++++++++++++++ ...{pr-preview.yml => pr-preview-publish.yml} | 56 +++++++++-------- .github/workflows/pr-preview-teardown.yml | 2 +- 3 files changed, 92 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/pr-preview-build.yml rename .github/workflows/{pr-preview.yml => pr-preview-publish.yml} (55%) diff --git a/.github/workflows/pr-preview-build.yml b/.github/workflows/pr-preview-build.yml new file mode 100644 index 000000000..171b65887 --- /dev/null +++ b/.github/workflows/pr-preview-build.yml @@ -0,0 +1,62 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: SonataFlow Guides Preview - Build + +on: + pull_request: + branches: + - "main" + paths-ignore: + - ".gitignore" + - "LICENSE" + - "README*" + - "CONTRIBUTING.md" +jobs: + build_site: + name: "Building WebSite with Antora" + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "16" + + - name: Set environment variables + run: | + echo "DOCSEARCH_ENABLED=true" >> $GITHUB_ENV + echo "DOCSEARCH_ENGINE=lunr" >> $GITHUB_ENV + echo "NODE_PATH=$(npm -g root)" >> $GITHUB_ENV + + - name: Check Node.js version + run: npm -v + + - name: Install dependencies and build + run: npm run local-install-build + + - name: Publishing directory for PR preview + if: github.event_name == 'pull_request' + uses: actions/upload-artifact@v4 + with: + name: site + path: ./build/site + retention-days: 3 diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview-publish.yml similarity index 55% rename from .github/workflows/pr-preview.yml rename to .github/workflows/pr-preview-publish.yml index 05e499ca9..767dd3822 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview-publish.yml @@ -1,39 +1,41 @@ -name: SonataFlow Guides Preview +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: SonataFlow Guides Preview - Publish on: - pull_request_target: - types: [opened, synchronize, reopened, ready_for_review, edited] - branches: [main] - paths-ignore: - - ".gitignore" - - "LICENSE" - - "README*" - - "CONTRIBUTING.md" + workflow_run: + workflows: ["SonataFlow Guides Preview - Build"] + types: + - completed jobs: build_site: - name: "Building SonataFlow Docs with Antora" + name: "Publishing WebSite with Surge.sh" runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 + - name: Download PR Artifact + uses: actions/download-artifact@v4 with: - node-version: "16" - - - name: Set environment variables - run: | - echo "DOCSEARCH_ENABLED=true" >> $GITHUB_ENV - echo "DOCSEARCH_ENGINE=lunr" >> $GITHUB_ENV - echo "NODE_PATH=$(npm -g root)" >> $GITHUB_ENV - - - name: Check Node.js version - run: npm -v - - - name: Install dependencies and build - run: npm run local-install-build + name: site + run-id: ${{ github.event.workflow_run.workflow_id }} - name: Publish to Surge for preview id: deploy diff --git a/.github/workflows/pr-preview-teardown.yml b/.github/workflows/pr-preview-teardown.yml index 5f04a7246..5dedd0dbb 100644 --- a/.github/workflows/pr-preview-teardown.yml +++ b/.github/workflows/pr-preview-teardown.yml @@ -17,7 +17,7 @@ # under the License. # -name: SonataFlow Guides Preview Teardown +name: SonataFlow Guides Preview - Teardown on: pull_request_target: From 102dab58c65dadec3d93071344ef8068b0b7d619 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Wed, 6 Mar 2024 14:03:07 -0300 Subject: [PATCH 8/9] Adds conditional to publish workflow Signed-off-by: Ricardo Zanini --- .github/workflows/pr-preview-publish.yml | 4 ++-- .github/workflows/sw-docs-pr.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-preview-publish.yml b/.github/workflows/pr-preview-publish.yml index 767dd3822..daf95ab88 100644 --- a/.github/workflows/pr-preview-publish.yml +++ b/.github/workflows/pr-preview-publish.yml @@ -26,11 +26,11 @@ on: - completed jobs: - build_site: + preview: name: "Publishing WebSite with Surge.sh" + if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest steps: - - name: Download PR Artifact uses: actions/download-artifact@v4 with: diff --git a/.github/workflows/sw-docs-pr.yml b/.github/workflows/sw-docs-pr.yml index c32cc5773..0cbdc45cd 100644 --- a/.github/workflows/sw-docs-pr.yml +++ b/.github/workflows/sw-docs-pr.yml @@ -17,7 +17,7 @@ # under the License. # -name: SonataFlow Guides Build +name: SonataFlow Guides - Verify Build on: pull_request: From a5b016c5913fce154441d6f7307cedbf68e37c79 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Wed, 6 Mar 2024 14:07:22 -0300 Subject: [PATCH 9/9] Added push event Signed-off-by: Ricardo Zanini --- .github/workflows/pr-preview-build.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-preview-build.yml b/.github/workflows/pr-preview-build.yml index 171b65887..1c6c3d4ae 100644 --- a/.github/workflows/pr-preview-build.yml +++ b/.github/workflows/pr-preview-build.yml @@ -20,9 +20,15 @@ name: SonataFlow Guides Preview - Build on: - pull_request: + push: branches: - - "main" + - "main" + paths-ignore: + - ".gitignore" + - "LICENSE" + - "README*" + - "CONTRIBUTING.md" + pull_request: paths-ignore: - ".gitignore" - "LICENSE"