From f8785658e5a69dc9dc411d6d5192b037c3cce376 Mon Sep 17 00:00:00 2001 From: Yufeng <92955983+yufengliu15@users.noreply.github.com> Date: Sat, 21 Oct 2023 15:44:26 -0400 Subject: [PATCH] Add preview (#376) * updated organizations * preview * preview --- .github/workflows/hugo-preview.yml | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/hugo-preview.yml diff --git a/.github/workflows/hugo-preview.yml b/.github/workflows/hugo-preview.yml new file mode 100644 index 000000000..7c9a84ef2 --- /dev/null +++ b/.github/workflows/hugo-preview.yml @@ -0,0 +1,38 @@ +name: Build and Deploy PR Preview to surge +# testing +on: + pull_request: + +jobs: + build_preview: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - 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: ${{ 1f147e7d61488c3db6957c80ab45939f }} + github_token: ${{ secrets.GITHUB_TOKEN }} + dist: public + failOnError: false + teardown: true + build: | + echo Deploying to surge.sh \ No newline at end of file