Skip to content

Commit

Permalink
Actions to preview docs (#511)
Browse files Browse the repository at this point in the history
* Actions to preview docs

* Added Jekyll, gemfile and changed url preview

* Update .github/workflows/preview_teardown.yml

Co-authored-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com>

* Update .github/workflows/preview.yml

Co-authored-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com>

* Update .github/workflows/preview.yml

Co-authored-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com>

* Changed build to run preview adoc files.

* Unused files

* Unused files

* Removing unnecessary step

---------

Co-authored-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com>
  • Loading branch information
luanbrdev and ricardozanini authored Oct 23, 2023
1 parent 0580227 commit 66d8b42
Show file tree
Hide file tree
Showing 9 changed files with 170 additions and 5 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ on:
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
- '.all-contributorsrc'

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

- name: Store PR id
run: |
echo ${{ github.event.number }} > ./docs/target/generated-docs/pr-id.txt
- name: Publishing directory for PR preview
uses: actions/upload-artifact@v3
with:
name: site
path: ./docs/target/generated-docs
retention-days: 3

build_reactive:
name: Build - RESTEasy Reactive
runs-on: ${{ matrix.os }}
Expand All @@ -73,4 +83,15 @@ jobs:
cache: 'maven'

- name: Build with Maven
run: mvn -Presteasy-reactive '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check verify --file pom.xml
run: mvn -Presteasy-reactive '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check verify --file pom.xml

- name: Store PR id
run: |
echo ${{ github.event.number }} > ./docs/target/generated-docs/pr-id.txt
- name: Publishing directory for PR preview
uses: actions/upload-artifact@v3
with:
name: site
path: ./docs/target/generated-docs
retention-days: 3
48 changes: 48 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Surge.sh Preview

on:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
preview:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
steps:
- name: Download PR Artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
name: site
- name: Store PR id as variable
id: pr
run: |
echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
rm -f pr-id.txt
- name: Publishing to surge for preview
id: deploy
run: npx surge ./ --domain https://quarkus-openapi-generator-preview-pr-${{ steps.pr.outputs.id }}.surge.sh --token ${{ secrets.SURGE_TOKEN }}
- name: Update PR status comment on success
uses: actions-cool/maintain-one-comment@v3.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
🎊 PR Preview ${{ github.sha }} has been successfully built and deployed to https://quarkus-openapi-generator-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}
- name: Update PR status comment on failure
if: ${{ failure() }}
uses: actions-cool/maintain-one-comment@v3.1.1
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 }}
24 changes: 24 additions & 0 deletions .github/workflows/preview_teardown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Surge.sh 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://quarkus-openapi-generator-preview-pr-${{ github.event.number }}.surge.sh --token ${{ secrets.SURGE_TOKEN }}
- name: Update PR status comment
uses: actions-cool/maintain-one-comment@v3.1.1
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 }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ public interface DefaultApi { /* omitted */ }

## Additional Properties as Attribute

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.
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.

## Template Customization

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-freemarker_quarkus.freemarker.d
List of directives to register with format name=classname
--|`Map<String,String>`
|
a| [[quarkus-freemarker_quarkus.freemarker.object-wrapper-expose-fields]]`link:#quarkus-freemarker_quarkus.freemarker.object-wrapper-expose-fields[quarkus.freemarker.object-wrapper-expose-fields]`
a| [[quarkus-freemarker_quarkus.freemarker.object-wrapper-expose-fields1]]`link:#quarkus-freemarker_quarkus.freemarker.object-wrapper-expose-fields[quarkus.freemarker.object-wrapper-expose-fields]`

[.description]
--
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ In your `pom.xml` file, add:
[[extension-configuration-reference]]
== Extension Configuration Reference

include::config.adoc[leveloffset=+1, opts=optional]
include::./includes/config.adoc[]
71 changes: 71 additions & 0 deletions docs/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkiverse.openapi.generator</groupId>
<artifactId>quarkus-openapi-generator-parent</artifactId>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>quarkus-openapi-generator-docs</artifactId>
<name>Quarkus - Openapi Generator - Documentation</name>

<dependencies>
<!-- Make sure the doc is built after the other artifacts -->
<dependency>
<groupId>io.quarkiverse.openapi.generator</groupId>
<artifactId>quarkus-openapi-generator-deployment</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>it.ozimov</groupId>
<artifactId>yaml-properties-maven-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/../.github/project.yml</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/modules/ROOT/pages/includes/</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/../target/asciidoc/generated/config/</directory>
<include>quarkus-openapi-generator.adoc</include>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<module>deployment</module>
<module>runtime</module>
<module>test-utils</module>
<module>docs</module>
</modules>
<scm>
<connection>:git:git@github.com:quarkiverse/quarkus-openapi-generator.git</connection>
Expand Down

0 comments on commit 66d8b42

Please sign in to comment.