Skip to content

Commit 66d8b42

Browse files
Actions to preview docs (#511)
* Actions to preview docs * Added Jekyll, gemfile and changed url preview * Update .github/workflows/preview_teardown.yml Co-authored-by: Ricardo Zanini <[email protected]> * Update .github/workflows/preview.yml Co-authored-by: Ricardo Zanini <[email protected]> * Update .github/workflows/preview.yml Co-authored-by: Ricardo Zanini <[email protected]> * Changed build to run preview adoc files. * Unused files * Unused files * Removing unnecessary step --------- Co-authored-by: Ricardo Zanini <[email protected]>
1 parent 0580227 commit 66d8b42

File tree

9 files changed

+170
-5
lines changed

9 files changed

+170
-5
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ on:
1818
- 'CODEOWNERS'
1919
- 'LICENSE'
2020
- '*.md'
21-
- '*.adoc'
2221
- '*.txt'
2322
- '.all-contributorsrc'
2423

@@ -49,6 +48,17 @@ jobs:
4948
- name: Build with Maven
5049
run: mvn '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check verify --file pom.xml
5150

51+
- name: Store PR id
52+
run: |
53+
echo ${{ github.event.number }} > ./docs/target/generated-docs/pr-id.txt
54+
55+
- name: Publishing directory for PR preview
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: site
59+
path: ./docs/target/generated-docs
60+
retention-days: 3
61+
5262
build_reactive:
5363
name: Build - RESTEasy Reactive
5464
runs-on: ${{ matrix.os }}
@@ -73,4 +83,15 @@ jobs:
7383
cache: 'maven'
7484

7585
- name: Build with Maven
76-
run: mvn -Presteasy-reactive '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check verify --file pom.xml
86+
run: mvn -Presteasy-reactive '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check verify --file pom.xml
87+
88+
- name: Store PR id
89+
run: |
90+
echo ${{ github.event.number }} > ./docs/target/generated-docs/pr-id.txt
91+
92+
- name: Publishing directory for PR preview
93+
uses: actions/upload-artifact@v3
94+
with:
95+
name: site
96+
path: ./docs/target/generated-docs
97+
retention-days: 3

.github/workflows/preview.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Surge.sh Preview
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
preview:
11+
runs-on: ubuntu-latest
12+
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
13+
steps:
14+
- name: Download PR Artifact
15+
uses: dawidd6/action-download-artifact@v2
16+
with:
17+
workflow: ${{ github.event.workflow_run.workflow_id }}
18+
workflow_conclusion: success
19+
name: site
20+
- name: Store PR id as variable
21+
id: pr
22+
run: |
23+
echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
24+
rm -f pr-id.txt
25+
- name: Publishing to surge for preview
26+
id: deploy
27+
run: npx surge ./ --domain https://quarkus-openapi-generator-preview-pr-${{ steps.pr.outputs.id }}.surge.sh --token ${{ secrets.SURGE_TOKEN }}
28+
- name: Update PR status comment on success
29+
uses: actions-cool/[email protected]
30+
with:
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
body: |
33+
🎊 PR Preview ${{ github.sha }} has been successfully built and deployed to https://quarkus-openapi-generator-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
34+
<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
35+
<!-- Sticky Pull Request Comment -->
36+
body-include: '<!-- Sticky Pull Request Comment -->'
37+
number: ${{ steps.pr.outputs.id }}
38+
- name: Update PR status comment on failure
39+
if: ${{ failure() }}
40+
uses: actions-cool/[email protected]
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
body: |
44+
😭 Deploy PR Preview failed.
45+
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png">
46+
<!-- Sticky Pull Request Comment -->
47+
body-include: '<!-- Sticky Pull Request Comment -->'
48+
number: ${{ steps.pr.outputs.id }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Surge.sh Preview Teardown
2+
3+
on:
4+
pull_request_target:
5+
paths:
6+
- '*.adoc'
7+
types: [closed]
8+
9+
jobs:
10+
preview-teardown:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Teardown surge preview
14+
id: deploy
15+
run: npx surge teardown https://quarkus-openapi-generator-preview-pr-${{ github.event.number }}.surge.sh --token ${{ secrets.SURGE_TOKEN }}
16+
- name: Update PR status comment
17+
uses: actions-cool/[email protected]
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
body: |
21+
🙈 The PR is closed and the preview is expired.
22+
<!-- Sticky Pull Request Comment -->
23+
body-include: '<!-- Sticky Pull Request Comment -->'
24+
number: ${{ github.event.number }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ public interface DefaultApi { /* omitted */ }
834834

835835
## Additional Properties as Attribute
836836

837-
If you want to map your models using composition instead inheretance for a better experience with Jackson, see the [Additional properties as attribute](./docs/modules/ROOT/pages/additional-properties-as-attribute.adoc) documentation.
837+
If you want to map your models using composition instead inheretance for a better experience with Jackson, see the [Additional properties as attribute](./docs/modules/ROOT/pages/includes/additional-properties-as-attribute.adoc) documentation.
838838

839839
## Template Customization
840840

File renamed without changes.

docs/modules/ROOT/pages/config.adoc renamed to docs/modules/ROOT/pages/includes/config.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-freemarker_quarkus.freemarker.d
108108
List of directives to register with format name=classname
109109
--|`Map<String,String>`
110110
|
111-
a| [[quarkus-freemarker_quarkus.freemarker.object-wrapper-expose-fields]]`link:#quarkus-freemarker_quarkus.freemarker.object-wrapper-expose-fields[quarkus.freemarker.object-wrapper-expose-fields]`
111+
a| [[quarkus-freemarker_quarkus.freemarker.object-wrapper-expose-fields1]]`link:#quarkus-freemarker_quarkus.freemarker.object-wrapper-expose-fields[quarkus.freemarker.object-wrapper-expose-fields]`
112112

113113
[.description]
114114
--

docs/modules/ROOT/pages/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ In your `pom.xml` file, add:
1919
[[extension-configuration-reference]]
2020
== Extension Configuration Reference
2121

22-
include::config.adoc[leveloffset=+1, opts=optional]
22+
include::./includes/config.adoc[]

docs/pom.xml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>io.quarkiverse.openapi.generator</groupId>
7+
<artifactId>quarkus-openapi-generator-parent</artifactId>
8+
<version>3.0.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>quarkus-openapi-generator-docs</artifactId>
12+
<name>Quarkus - Openapi Generator - Documentation</name>
13+
14+
<dependencies>
15+
<!-- Make sure the doc is built after the other artifacts -->
16+
<dependency>
17+
<groupId>io.quarkiverse.openapi.generator</groupId>
18+
<artifactId>quarkus-openapi-generator-deployment</artifactId>
19+
<version>${project.version}</version>
20+
</dependency>
21+
</dependencies>
22+
23+
<build>
24+
<plugins>
25+
<plugin>
26+
<groupId>it.ozimov</groupId>
27+
<artifactId>yaml-properties-maven-plugin</artifactId>
28+
<executions>
29+
<execution>
30+
<phase>initialize</phase>
31+
<goals>
32+
<goal>read-project-properties</goal>
33+
</goals>
34+
<configuration>
35+
<files>
36+
<file>${project.basedir}/../.github/project.yml</file>
37+
</files>
38+
</configuration>
39+
</execution>
40+
</executions>
41+
</plugin>
42+
<plugin>
43+
<artifactId>maven-resources-plugin</artifactId>
44+
<executions>
45+
<execution>
46+
<id>copy-resources</id>
47+
<phase>generate-resources</phase>
48+
<goals>
49+
<goal>copy-resources</goal>
50+
</goals>
51+
<configuration>
52+
<outputDirectory>${project.basedir}/modules/ROOT/pages/includes/</outputDirectory>
53+
<resources>
54+
<resource>
55+
<directory>${project.basedir}/../target/asciidoc/generated/config/</directory>
56+
<include>quarkus-openapi-generator.adoc</include>
57+
<filtering>false</filtering>
58+
</resource>
59+
</resources>
60+
</configuration>
61+
</execution>
62+
</executions>
63+
</plugin>
64+
<plugin>
65+
<groupId>org.asciidoctor</groupId>
66+
<artifactId>asciidoctor-maven-plugin</artifactId>
67+
</plugin>
68+
</plugins>
69+
</build>
70+
</project>
71+

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<module>deployment</module>
1616
<module>runtime</module>
1717
<module>test-utils</module>
18+
<module>docs</module>
1819
</modules>
1920
<scm>
2021
<connection>:git:[email protected]:quarkiverse/quarkus-openapi-generator.git</connection>

0 commit comments

Comments
 (0)