|
| 1 | +## Deploy to GH-Pages for your Quarkus Roq blog. |
| 2 | +name: Quarkus Roq Deploy CI |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [ main ] |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +env: |
| 10 | + QUARKUS_ROQ_GENERATOR_BATCH: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - name: Set up JDK 21 |
| 18 | + uses: actions/setup-java@v4 |
| 19 | + with: |
| 20 | + java-version: 21 |
| 21 | + distribution: 'temurin' |
| 22 | + cache: 'maven' |
| 23 | + - name: Get GitHub Pages URL |
| 24 | + id: get_url |
| 25 | + env: |
| 26 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + run: | |
| 28 | + url=$(gh api "repos/$GITHUB_REPOSITORY/pages" --jq '.html_url');echo "ghp-url=$url"; |
| 29 | + path=$(echo "$url" | sed -E 's|https?://[^/]+(/.*)?|\1|') |
| 30 | + url=$(echo "$url" | sed -E 's|(https?://[^/]+).*|\1|') |
| 31 | + if [ -z "$path" ]; then |
| 32 | + path="/" |
| 33 | + fi |
| 34 | + echo "SITE_URL=$url"; echo "SITE_URL=$url" >> $GITHUB_ENV; |
| 35 | + echo "SITE_PATH=$path"; echo "SITE_PATH=$path" >> $GITHUB_ENV; |
| 36 | + - name: Build & Generate Blog |
| 37 | + run: mvn -B package quarkus:run -DskipTests -Dquarkus.http.root-path=$SITE_PATH -Dsite.url=$SITE_URL |
| 38 | + - name: Upload site as artifact |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: site |
| 42 | + path: target/roq |
| 43 | + retention-days: 1 |
| 44 | + deploy: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + needs: build |
| 47 | + permissions: |
| 48 | + pages: write # to deploy to Pages |
| 49 | + id-token: write # to verify the deployment originates from an appropriate source |
| 50 | + environment: |
| 51 | + name: github-pages |
| 52 | + url: ${{ steps.deployment.outputs.page_url }} |
| 53 | + steps: |
| 54 | + - name: Download Built site |
| 55 | + uses: actions/download-artifact@v4 |
| 56 | + with: |
| 57 | + name: site |
| 58 | + path: _site |
| 59 | + - name: Setup Pages |
| 60 | + uses: actions/configure-pages@v5 |
| 61 | + - name: Upload artifact |
| 62 | + uses: actions/upload-pages-artifact@v3 |
| 63 | + - name: Deploy to GitHub Pages |
| 64 | + id: deployment |
| 65 | + uses: actions/deploy-pages@v4 |
0 commit comments