-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addresses SRGSSR/pillarbox-web#196 by introducing pull request previews using `rossjrw/pr-preview-action`. This new workflow enables us to review both visual and functional changes before merging. The preview functionality work in the following manner: 1. **Triggering a Preview**: Whenever a pull request is either opened, re-opened, or updated, the project undergoes a build process. The contents of the `dist` directory are copied under `pr-preview/pr-${github.ref}` located in the `gh-pages` branch. 2. **Cleaning Up**: Once a pull request is closed, the corresponding preview folder (specific to the closed pull request) is deleted. Additional workflow updates include: - The `JamesIves/github-pages-deploy-action` has been updated from version 3 to version 4. This update introduces the following configurations to this action: - `force: false`: This disables force push to the deployment branch. - `clean-exclude: pr-preview/`: This prevents the deletion of PR previews when the main branch is deployed.
- Loading branch information
Showing
3 changed files
with
57 additions
and
7 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
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,48 @@ | ||
name: Deploy PR previews | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- closed | ||
|
||
concurrency: preview-${{ github.ref }} | ||
|
||
jobs: | ||
deploy-preview: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
always-auth: true | ||
registry-url: https://npm.pkg.github.com/ | ||
scope: '@srgssr' | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install dependencies | ||
if: github.event.action != 'closed' | ||
env: | ||
CI: true | ||
run: | | ||
npm pkg delete scripts.prepare | ||
npm ci | ||
- name: Run build | ||
if: github.event.action != 'closed' | ||
run: | | ||
npm run build | ||
- name: Deploy preview | ||
uses: rossjrw/pr-preview-action@v1 | ||
with: | ||
source-dir: dist | ||
preview-branch: gh-pages | ||
umbrella-dir: pr-preview |
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