How to integrate PageShare with GitHub actions?

Using this method of installing PageShare is the easiest way to have it integrated with GitHub in a way that each Pull Request will automatically have uploaded page.
Inside your GitHub workflow add this step when your frontend project is built:
steps:
- uses: pageshare/gh-action-publish@v1
with:
path: ./dist
access-token: ${{ secrets.PAGESHARE_ACCESS_TOKEN }}
If you don't have working GitHub workflow, create a .github/workflows/pageshare.yml
file and copy:
name: Upload frontend to PageShare
on:
- pull_request
jobs:
upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
cache: "npm"
- run: npm ci
- run: npm run build
- uses: pageshare/gh-action-publish@v1
with:
path: ./dist
access-token: ${{ secrets.PAGESHARE_ACCESS_TOKEN }}
Add a new secret (on your GitHub repository page, go to "Secrets" -> "New repository secret") with a name PAGESHARE_ACCESS_TOKEN
. Copy your private access token from the PageShare settings page as value. It guarantees that no one else will get access to your PageShare account.
Make sure that path
parameter points to a folder when your built frontend project can be found (this folder needs to include index.html
file).
Besides already used path
and access-token
parameters, you can also specify:
- config - Path to the
pageshare.config.ts
file. - mock-server - Path to the mock server. Learn more reading https://www.pageshare.dev/blog/how-to-use-mock-server.