diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..36b4c1b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,36 @@ +name: 發布angular + +on: + push: + branches: + - main # 触发部署的分支,可以根据实际情况调整 + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' # 使用的 Node.js 版本 + + - name: Install Angular CLI + run: npm install -g @angular/cli + + - name: Install dependencies + run: npm install + + - name: Build Angular app + run: ng build --configuration=production + + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@3.7.1 + with: + ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages # 要部署到的分支,比如 gh-pages + FOLDER: dist/demo # Angular 应用程序的构建输出目录 + CLEAN: true # 可选项,是否清除目标分支的其他文件,默认为 true