-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36d5e5c
commit 33692c2
Showing
1 changed file
with
47 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,47 @@ | ||
name: Build and Deploy PR Preview to surge | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build_preview: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Ruby Dev | ||
run: sudo apt-get install ruby-dev | ||
|
||
- name: Install AsciiDoctor | ||
run: sudo gem install asciidoctor | ||
|
||
- name: Install Rouge | ||
run: sudo gem install rouge -v 3.30.0 | ||
|
||
- name: Setup Hugo | ||
uses: peaceiris/actions-hugo@v2 | ||
with: | ||
hugo-version: '0.105.0' | ||
|
||
- name: Setup base URL env var | ||
run: | | ||
export PRNUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") | ||
echo BASEURL="https://rmoff-rmoff-blog-build_preview-pr-"$PRNUMBER".surge.sh/" >> $GITHUB_ENV | ||
- name: Report base URL env var | ||
run: echo "${{ env.BASEURL }}" | ||
|
||
- name: Build | ||
run: hugo --baseURL "${{ env.BASEURL }}" | ||
|
||
- name: Deploy to surge | ||
uses: afc163/surge-preview@v1 | ||
id: preview_step | ||
with: | ||
surge_token: ${{ secrets.SURGE_TOKEN }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
dist: public | ||
failOnError: false | ||
teardown: true | ||
build: | | ||
echo Deploying to surge.sh |