diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 000000000..afa04efea --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,19 @@ +name: 🔂 Surge PR Preview + +on: [push, pull_request] + +jobs: + preview: + runs-on: ubuntu-latest + env: + PUBLIC_PATH: '/' + steps: + - uses: actions/checkout@v2 + - uses: afc163/surge-preview@v1 + with: + surge_token: ${{ secrets.SURGE_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + build: | + npm install + ./node_modules/.bin/vant-cli build-site + dist: site diff --git a/vant.config.js b/vant.config.js index e37f930e1..01c1390b0 100644 --- a/vant.config.js +++ b/vant.config.js @@ -4,7 +4,7 @@ module.exports = { srcDir: 'src', skipInstall: ['lazyload'], site: { - publicPath: 'https://b.yzcdn.cn/vant/', + publicPath: process.env.PUBLIC_PATH || 'https://b.yzcdn.cn/vant/', }, vetur: { tagPrefix: 'van-',