Skip to content

Commit

Permalink
First attempt to build on pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabrielgerez committed Jun 10, 2024
1 parent c32ecea commit 10f4fdf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
- name: Extract pull request number
id: pr
run: echo "::set-output name=number::$(echo ${{ github.event.pull_request.number }})"
if: ${{ github.event_name == 'pull_request' }}
- name: Set environment variables
run: |
echo "TARGET_BRANCH=${{ env.TARGET_BRANCH }}-${{ steps.pr.outputs.number }}" >> $GITHUB_ENV
echo "CNAME=pr-${{ steps.pr.outputs.number }}.${{ env.CNAME }}" >> $GITHUB_ENV
if: ${{ github.event_name == 'pull_request' }}
- name: Install zola
run: |
set -x
Expand All @@ -61,9 +70,10 @@ jobs:
echo "Used CNAME from the action workflow file"
fi
- name: Deploy to gh-pages
if: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', env.MAIN_BRANCH) }}
if: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', env.MAIN_BRANCH) || github.event_name == 'pull_request' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
force_orphan: true
publish_branch: ${{ env.TARGET_BRANCH }}

0 comments on commit 10f4fdf

Please sign in to comment.