Skip to content

Commit

Permalink
chore: print netlify preview url (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
webhookx-x authored Aug 28, 2024
1 parent 60e918d commit 15cd42e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: Deploy

on:
pull_request:
paths-ignore:
- 'README.md'
push:
branches:
- main
paths-ignore:
- 'README.md'

jobs:
deploy:
Expand All @@ -20,11 +25,20 @@ jobs:

- run: npm run docs:build

- name: deploy to netlify
- name: deploy to netlify (prod)
if: ${{ github.ref_name == 'main' }}
uses: netlify/actions/cli@master
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
with:
args: deploy --dir=.vitepress/dist --prod
secrets: '["NETLIFY_AUTH_TOKEN", "NETLIFY_SITE_ID"]'

- name: deploy to netlify (dev)
if: ${{ github.ref_name != 'main' }}
uses: netlify/actions/cli@master
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
with:
args: deploy --dir=.vitepress/dist --alias=preview-${{ github.event.number }}
26 changes: 26 additions & 0 deletions .github/workflows/preview-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Preview comment

on:
pull_request:
types:
- opened
paths-ignore:
- 'README.md'

permissions:
pull-requests: write

jobs:
preview-deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'This pull request is being automatically deployed to Netlify.\n\n✅ Preview: https://preview-${{ github.event.number }}--webhookx.netlify.app'
})
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@



Install vitepress
### 1. Install VitePress

```terminal
$ npm add -D vitepress
```

### 2. Start website
```terminal
$ make dev
```

visit http://localhost:5173/
Visit http://localhost:5173/

0 comments on commit 15cd42e

Please sign in to comment.