Skip to content

Commit

Permalink
Fix #537 - Add surge.sh preview GHA
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Zanini <[email protected]>
  • Loading branch information
ricardozanini committed Feb 29, 2024
1 parent c79b03e commit d8468b8
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 45 deletions.
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: 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
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"
14 changes: 8 additions & 6 deletions .github/workflows/sw-docs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
2 changes: 2 additions & 0 deletions antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ content:
start_path: serverlessworkflow
runtime:
fetch: true
log:
failure_level: warn
ui:
bundle:
url: ./antora/ui-bundle.zip
Expand Down

0 comments on commit d8468b8

Please sign in to comment.