mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-06 08:27:54 +08:00
ci: update
This commit is contained in:
parent
3e8dfb2bcb
commit
8e886e83e7
34
.github/workflows/preview.yml
vendored
Normal file
34
.github/workflows/preview.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
name: preview
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [12.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: "16"
|
||||||
|
registry-url: https://registry.npmjs.com/
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v2
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
- name: run deploy.sh
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: pnpm install && pnpm deploy
|
30
deploy.sh
Normal file
30
deploy.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Replace packaging path
|
||||||
|
sed -i "s#VITE_PUBLIC_PATH = /#VITE_PUBLIC_PATH = /vue-pure-admin/#g" $(pwd)/.env.production
|
||||||
|
|
||||||
|
# Make sure the script throws the error encountered
|
||||||
|
set -e
|
||||||
|
|
||||||
|
pnpm build
|
||||||
|
cd dist
|
||||||
|
touch README.md .nojekyll
|
||||||
|
|
||||||
|
# deploy to github
|
||||||
|
if [ -z "$GITHUB_TOKEN" ]; then
|
||||||
|
msg='deploy'
|
||||||
|
githubUrl=git@github.com:xiaoxian521/vue-pure-admin.git
|
||||||
|
else
|
||||||
|
msg='ci: Automatic deployment from github actions'
|
||||||
|
githubUrl=https://xiaoxian521:${GITHUB_TOKEN}@github.com/xiaoxian521/vue-pure-admin.git
|
||||||
|
git config --global user.name "xiaoxian521"
|
||||||
|
git config --global user.email "1923740402@qq.com"
|
||||||
|
fi
|
||||||
|
git init
|
||||||
|
git add -A
|
||||||
|
git commit -m "${msg}"
|
||||||
|
# Push to github gh-pages branch
|
||||||
|
git push -f $githubUrl master:gh-pages
|
||||||
|
|
||||||
|
cd -
|
||||||
|
rm -rf dist
|
@ -2,15 +2,12 @@
|
|||||||
"name": "vue-pure-admin",
|
"name": "vue-pure-admin",
|
||||||
"version": "3.0",
|
"version": "3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
|
||||||
"node": ">= 16",
|
|
||||||
"pnpm": ">= 6"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env --max_old_space_size=4096 vite",
|
"dev": "cross-env --max_old_space_size=4096 vite",
|
||||||
"serve": "pnpm dev",
|
"serve": "pnpm dev",
|
||||||
"build": "rimraf dist && cross-env vite build",
|
"build": "rimraf dist && cross-env vite build",
|
||||||
"report": "rimraf dist && cross-env vite build",
|
"report": "rimraf dist && cross-env vite build",
|
||||||
|
"deploy": "bash deploy.sh",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"preview:build": "pnpm build && vite preview",
|
"preview:build": "pnpm build && vite preview",
|
||||||
"clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install",
|
"clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user