Skip to content

Commit

Permalink
feat: bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
liufu.lf committed May 24, 2021
1 parent edde6cb commit 45e4f49
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
teardown: 'true'
dist: public/preview
dist: pub/preview

build: |
mkdir -p public/preview
mkdir -p pub/preview
npm install
- name: Get the output url
run: echo "url => ${{ steps.preview_step.outputs.preview_url }}"
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ inputs:
build:
description: 'build scripts'
default: |
mkdir -p public/preview
mkdir -p pub/preview
npm install
required: false
dist:
description: 'dist folder to deploy'
default: 'public/preview'
default: 'pub/preview'
required: false
failOnError:
description: 'Set `failed` if a deployment throws error'
Expand Down
13 changes: 9 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ let fail: (err: Error) => void;

async function build() {
return new Promise(async (resovle) => {
// const project_name = core.getInput('project_name') || 'G2Plot';
// const project_branch = core.getInput('project_branch') || 'master';
await exec(`pwd`);
const project_name = core.getInput('project_name') || 'G2Plot';
const project_branch = core.getInput('project_branch') || 'master';
await exec('cd ..');
await exec('git clone https://github.com/lxfu1/surge-preview.git');
await exec(`ls`);
await exec(`npx sh start.sh ${project_name} ${project_branch}`);
await exec(`mkdir public`);
await exec(`cp -r ../public/* ./pub`);
await exec(`ls`);
// await exec(`npx sh start.sh ${project_name} ${project_branch}`);
// await exec(`ls ./public/preview`);
// await exec(`ls ./pub/preview`);
resovle(null);
});
}
Expand Down
2 changes: 1 addition & 1 deletion utils/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const core = require('@actions/core');
const project_name = core.getInput('project_name') || 'G2Plot';
const project_branch = core.getInput('project_branch') || 'master';
shell.exec(`npx sh start.sh ${project_name} ${project_branch}`);
shell.exec(`ls ./public/preview`);
shell.exec(`ls ./pub/preview`);
return;
})();
3 changes: 2 additions & 1 deletion web-server/server/utils/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const shell = require('shelljs');
const fs = require('fs');

const useStatic = async () => {
const basePath = '../../public/preview';
const basePath = '../../pub/preview';
shell.exec('ls');
// 删除 preview 静态文件
if (!fs.existsSync(basePath)) {
shell.exec(`mkdir -p ${basePath}`);
Expand Down

0 comments on commit 45e4f49

Please sign in to comment.