Skip to content

Commit

Permalink
Merge pull request #181 from mcruzdev/issue-180
Browse files Browse the repository at this point in the history
Add surge
  • Loading branch information
mcruzdev authored Oct 14, 2024
2 parents ffea26b + eae13a0 commit 75fbb1d
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 12 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build-sites.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build Sites

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 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: 'maven'

- name: Build docs
run: mvn -B 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 docs
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: docs
path: ./docs/target/generated-docs
retention-days: 3

- name: Build blog
run: |
QUARKUS_ROQ_GENERATOR_BATCH=true mvn -f blog package quarkus:run
- name: Publishing blog
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: blog
path: ./blog/target/roq
retention-days: 3
19 changes: 16 additions & 3 deletions .github/workflows/preview-docs-teardown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
permissions:
pull-requests: write # Required to update PR status comment
steps:
- name: Teardown surge preview
- name: Teardown Surge.sh preview (docs)
id: deploy
run: npx surge teardown https://quarkiverse-roq-pr-${{ github.event.number }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }} || true
run: npx surge teardown https://quarkiverse-roq-docs-${{ github.event.number }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }} || true
- name: Update PR status comment
uses: quarkusio/action-helpers@main
with:
Expand All @@ -22,4 +22,17 @@ jobs:
pr-number: ${{ github.event.number }}
body: |
🙈 The PR is closed and the preview is expired.
body-marker: <!-- Preview status comment marker -->
body-marker: <!-- Preview status comment marker -->

- name: Teardown Surge.sh preview (blog)
id: deploy
run: npx surge teardown https://quarkiverse-roq-blog-${{ github.event.number }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }} || true
- name: Update PR status comment
uses: quarkusio/action-helpers@main
with:
action: maintain-one-comment
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ github.event.number }}
body: |
🙈 The PR is closed and the preview is expired.
body-marker: <!-- Preview status comment marker -->
41 changes: 32 additions & 9 deletions .github/workflows/preview-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Surge.sh Preview

on:
workflow_run:
workflows: [ "Publish website" ]
workflows: [ "Build Sites" ]
types:
- completed

Expand All @@ -20,7 +20,7 @@ jobs:
- name: Download PR Artifact
uses: actions/download-artifact@v4
with:
name: site
name: docs
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

Expand All @@ -37,21 +37,45 @@ jobs:
echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
rm -f pr-id.txt
- name: Publishing to surge for preview
- name: Publishing docs to Surge.sh
id: deploy
run: npx surge ./ --domain https://quarkiverse-roq-pr-${{ steps.pr.outputs.id }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }}
run: npx surge ./ --domain https://quarkiverse-roq-docs-${{ steps.pr.outputs.id }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }}

- name: Update PR status comment on success
- name: Update PR status comment on success (docs)
uses: quarkusio/action-helpers@main
with:
action: maintain-one-comment
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ steps.pr.outputs.id }}
body: |
🚀 PR Preview ${{ github.sha }} has been successfully built and deployed to https://quarkiverse-roq-pr-${{ steps.pr.outputs.id }}-preview.surge.sh
🚀 PR Preview for **docs** ${{ github.sha }} has been successfully built and deployed to https://quarkiverse-roq-docs-${{ steps.pr.outputs.id }}-preview.surge.sh
body-marker: <!-- Preview status comment marker -->

<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
- name: Update PR status comment on failure
uses: quarkusio/action-helpers@main
if: ${{ failure() }}
with:
action: maintain-one-comment
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ steps.pr.outputs.id }}
body: |
😭 Deploy PR Preview for **docs** failed.
body-marker: <!-- Preview status comment marker -->

- name: Publishing blog to Surge.sh
id: deploy-blog
run: npx surge ./ --domain https://quarkiverse-roq-blog-${{ steps.pr.outputs.id }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }}

- name: Update PR status comment on success (blog)
uses: quarkusio/action-helpers@main
with:
action: maintain-one-comment
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ steps.pr.outputs.id }}
body: |
🚀 PR Preview for **blog** ${{ github.sha }} has been successfully built and deployed to https://quarkiverse-roq-blog-${{ steps.pr.outputs.id }}-preview.surge.sh
body-marker: <!-- Preview status comment marker -->

- name: Update PR status comment on failure
uses: quarkusio/action-helpers@main
if: ${{ failure() }}
Expand All @@ -60,6 +84,5 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ steps.pr.outputs.id }}
body: |
😭 Deploy PR Preview failed.
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png">
😭 Deploy PR Preview for **blog** failed.
body-marker: <!-- Preview status comment marker -->

0 comments on commit 75fbb1d

Please sign in to comment.