我正在尝试制作一个 GH-Action 文件来构建我的 Nodejs 应用程序,然后部署它。 问题是, tsc 可以工作(至少需要一段时间),但构建后不存在 /dist 文件夹。 tsconfig 看起来像这样:
{
"compilerOptions": {
"strict": true,
"outDir": "dist",
"target": "ES6",
"esModuleInterop": true,
"moduleResolution": "node",
"module": "commonjs"
},
"include": ["./src/**/*"]
}
gh 操作文件的部分如下所示:
name: Build & Deploy
on:
push:
branches: ['deploy']
pull_request:
branches: ['deploy']
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: install node v18
uses: actions/setup-node@v1
with:
node-version: 18
- name: yarn install
run: yarn install
- name: tsc
uses: icrawl/action-tsc@v1
- name: List files in the workspace repository
run: |
ls ${{ github.workspace }}
- name: List files in ./
run: |
ls ./
- uses: a7ul/[email protected]
with:
command: c
cwd: './'
files: |
citygml-tools-2.1.0/
src/
#dist does not exist!?
dist/
tmp/
.dockerignore
Dockerfile
package.json
tsconfig.json
captain-definition
outPath: deploy.tar
# - name: Deploy App to CapRover
# uses: caprover/[email protected]
# with:
# server: '${{ secrets.CAPROVER_SERVER }}'
# app: '${{ secrets.APP_NAME }}'
# token: '${{ secrets.APP_TOKEN }}'
- name: Deploy App to CapRover
uses: caprover/[email protected]
with:
server: '${{ secrets.CAPROVER_PFCACE_SERVER }}'
app: '${{ secrets.APP_NAME }}'
token: '${{ secrets.APP_PFCACE_TOKEN }}'
我尝试使用 ls 列出文件夹中的文件,但没有 dist 文件夹(我期望 tsc 完成后)。
当我在本地运行 tsc 时,它正是这样做的:在“./dist”内构建应用程序
知道这是怎么回事吗?
对我来说解决这个问题的方法是将
uses: icrawl/action-tsc@v1
替换为 run: yarn tsc