From b6eaf0381ebe015c029a96a0e51e63c42bb0f1d8 Mon Sep 17 00:00:00 2001 From: wzp Date: Wed, 5 Jun 2024 18:05:02 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E5=88=9B=E5=BB=BA=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..69e88e8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: CI +on: + push: + branches: [ "v2" ] + pull_request: + branches: [ "v2" ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: 克隆项目 + with: + ref: v2 + - uses: actions/setup-node@v4 + name: 创建nodejs环境 + with: + node-version: ">=20.11.1" + - name: 下载PNPM + run: npm install pnpm + - name: 下载项目依赖 + run: pnpm install + - name: 构建项目 + run: pnpm run build + - name: 将项目压缩为zip + run: cd dist && zip -r ../result.zip . && cd .. + - name: 创建版本 + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: 上传构建后的文件 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist.zip + asset_name: v${{ github.ref }}.zip + asset_content_type: application/zip \ No newline at end of file