Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #537 - Add surge.sh preview GHA #539

Merged
merged 9 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/jenkins-tests-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: 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
branch-config-file-repo: apache/incubator-kie-kogito-pipelines
52 changes: 25 additions & 27 deletions .github/workflows/npm-publish-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -34,7 +34,6 @@ permissions:

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand All @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/pr-backporting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -56,4 +56,4 @@ jobs:
uses: kiegroup/kie-ci/.ci/actions/backporting@main
with:
target-branch: ${{ matrix.target-branch }}
additional-reviewers: ${REVIEWERS}
additional-reviewers: ${REVIEWERS}
43 changes: 43 additions & 0 deletions .github/workflows/pr-preview-teardown.yml
Original file line number Diff line number Diff line change
@@ -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.
<!-- Sticky Pull Request Comment -->
body-include: "<!-- Sticky Pull Request Comment -->"
number: ${{ github.event.number }}
72 changes: 72 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -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
<!-- Sticky Pull Request Comment -->
body-include: "<!-- Sticky Pull Request Comment -->"
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.
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png">
<!-- Sticky Pull Request Comment -->
body-include: "<!-- Sticky Pull Request Comment -->"
number: ${{ steps.pr.outputs.id }}
emojis: "confused"
15 changes: 8 additions & 7 deletions .github/workflows/sw-docs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,28 @@
# 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
- run: npm run install-build
- run: npm run local-install-build
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way we force the action to FAIL in case of any problems within the PR. In this action, doesn't make much sense to run the full build. That's only required when publishing on the live website.

3 changes: 3 additions & 0 deletions antora-playbook-author.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ content:
- url: .
branches: HEAD
start_path: serverlessworkflow
runtime:
log:
failure_level: warn
ui:
bundle:
url: ./antora/ui-bundle.zip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.<function_name>.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.

Expand Down Expand Up @@ -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

Expand Down
Loading