diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 895dbed..daf59d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,4 +18,5 @@ jobs: uses: peaceiris/actions-gh-pages@v3 with: publish_dir: ./build + keep_files: true github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..0fd17f7 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,33 @@ +name: Publish PR to gh-pages/pr/ +on: + pull_request: + branches: [ main ] +jobs: + build: + runs-on: ubuntu-latest + permissions: + pull-requests: write + if: ${{ github.event.number }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + - run: npm install + - run: npm run build + - name: Publish HTML to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + publish_dir: ./build + destination_dir: pr/${{ github.event.number }}/ + keep_files: true + github_token: ${{ secrets.GITHUB_TOKEN }} + - id: get-preview-url + name: Get preview url + run: echo "::set-output name=preview-url::https://tc39.es/$(basename $GITHUB_REPOSITORY)/pr/${{ github.event.number }}" + shell: bash + - name: Post Preview Comment + uses: phulsechinmay/rewritable-pr-comment@v0.3.0 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMMENT_IDENTIFIER: tc39_pr_preview_comment + message: | + A preview of this PR can be found at ${{ steps.get-preview-url.outputs.preview-url }}. \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3eee819..dd87e2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -node_modules -build +node_modules +build