forked from quarkiverse/quarkus-qute-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkiverse#50 from mcruzdev/issue-49
Add workflows
- Loading branch information
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Build Website | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
paths-ignore: | ||
- ".gitignore" | ||
- "CODEOWNERS" | ||
- "LICENSE" | ||
- "*.md" | ||
- "*.adoc" | ||
- "*.txt" | ||
- ".all-contributorsrc" | ||
pull_request: | ||
paths-ignore: | ||
- ".gitignore" | ||
- "CODEOWNERS" | ||
- "LICENSE" | ||
- "*.md" | ||
- "*.txt" | ||
- ".all-contributorsrc" | ||
jobs: | ||
build-website: | ||
name: Build Website | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
cache: "maven" | ||
|
||
- name: Build with Maven | ||
run: mvn -B formatter:validate impsort:check verify --file pom.xml -DskipTests | ||
|
||
- name: Store PR id | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
echo ${{ github.event.number }} > ./docs/target/generated-docs/pr-id.txt | ||
- name: Publishing directory for PR preview | ||
if: github.event_name == 'pull_request' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: site | ||
path: ./docs/target/generated-docs | ||
retention-days: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Surge.sh Preview | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Build Website"] | ||
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@v6 | ||
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-roq-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.2.0 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: | | ||
🎊 PR Preview ${{ github.sha }} has been successfully built and deployed. See the documentation preview: https://quarkus-roqpreview-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.2.0 | ||
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" |