Translated #89
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
name: pull-request | |
on: pull_request_target | |
jobs: | |
deploy: | |
name: Deploy localized site preview to surge.sh | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout base branch | |
# To avoid GitHub Secrets compromise, checkout base branch to get reliable (untainted) build scripts | |
uses: actions/checkout@v3 | |
- name: Checkout merged commit to 'merged' dir | |
# Checkout merged commit to 'merged' dir | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
path: merged | |
- name: Copy l10n dir | |
# Copy the merged commit's l10n dir to base branch code base for build | |
run: | | |
rm -rf l10n | |
cp -r merged/l10n ./ | |
- name: Cache bundle directory | |
# Cache ruby bundle directory to speed up build | |
uses: actions/cache@v3 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} | |
- name: Setup build env | |
# Setup build environment(install runtime, library, etc.) | |
run: | | |
bin/setup-build-env-on-ubuntu | |
- name: Build for preview | |
# Build for preview to build a localized site (only latest guides are built) | |
run: vendor/quarkus-l10n-utils/bin/build-for-preview | |
- name: Deploy to surge | |
# Deploy the site to surge.sh | |
# We use surge.sh for pull-request preview because surge.sh supports custom sub-domain and it fits pull-request preview site. | |
run: | | |
surge docs pr-preview-"${{ github.event.pull_request.number }}"-es-quarkusio.surge.sh | |
env: | |
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | |
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
- name: Add comment | |
# Add comment to the pull request to announce the deployed preview site URL. | |
uses: actions/[email protected] | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
let body = `Site preview(pt): https://pr-preview-${{ github.event.pull_request.number }}-es-quarkusio.surge.sh` | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) |