Browse Source

ci: 使用 pkg-pr-new 预发布 PR 并生成预览模板 (#2175)

* ci: 使用 pkg-pr-new 预发布 PR 并生成预览模板

* update

* update

* update

* ci: 更换文件名

---------

Co-authored-by: 贤心 <3277200+sentsim@users.noreply.github.com>
pull/2181/head
morning-star 3 months ago committed by GitHub
parent
commit
d9635625e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      .github/workflows/pr-preview.yml
  2. 4
      examples/pr-preview/README.md
  3. 15
      examples/pr-preview/index.html
  4. 6
      examples/pr-preview/index.js
  5. 17
      examples/pr-preview/package.json

23
.github/workflows/pr-preview.yml

@ -0,0 +1,23 @@
name: Publish Pull Request Preview
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- run: npx pkg-pr-new publish --template './examples/pr-preview'

4
examples/pr-preview/README.md

@ -0,0 +1,4 @@
# 预览
- npm install
- npm run dev

15
examples/pr-preview/index.html

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>layui-example</title>
<link href="node_modules/layui/dist/css/layui.css" rel="stylesheet">
</head>
<body class="layui-padding-3">
<button type="button" class="layui-btn">默认按钮</button>
<script src="node_modules/layui/dist/layui.js"></script>
<script src="./index.js"></script>
</body>
</html>

6
examples/pr-preview/index.js

@ -0,0 +1,6 @@
layui.use(function(){
var $ = layui.$;
var layer = layui.layer;
layer.msg(layui.v);
})

17
examples/pr-preview/package.json

@ -0,0 +1,17 @@
{
"name": "layui-example",
"private": true,
"version": "0.0.0",
"description": "generated by pkg.pr.new",
"main": "index.js",
"type": "module",
"scripts": {
"dev": "servor --reload"
},
"dependencies": {
"servor": "^4.0.2",
"layui": "latest"
},
"author": "pkg.pr.new",
"license": "ISC"
}
Loading…
Cancel
Save