From 44884ca5caf3b2cc7c16f68219f85069cb80823b Mon Sep 17 00:00:00 2001 From: wood chen Date: Fri, 21 Mar 2025 20:32:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20GitHub=20=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 60 +++++------------------------------ 1 file changed, 8 insertions(+), 52 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05d762b..d57ec9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,66 +8,22 @@ on: permissions: contents: write -env: - PLUGIN_NAME: lskypro-upload - jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # 获取完整历史记录 - + - uses: actions/checkout@v4 + - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: '22.x' - - - name: Get Version - id: version - run: | - echo "version=$(node -p "require('./manifest.json').version")" >> $GITHUB_OUTPUT - echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - - - name: Check Version Match - run: | - if [ "${{ steps.version.outputs.version }}" != "${{ steps.version.outputs.tag }}" ]; then - echo "Version in manifest.json (${{ steps.version.outputs.version }}) does not match tag (${{ steps.version.outputs.tag }})" - exit 1 - fi - - - name: Install Dependencies - run: npm install + node-version: "22.x" - name: Build plugin - run: npm run build - - - name: Create release package run: | - mkdir ${{ env.PLUGIN_NAME }} - cp main.js manifest.json ${{ env.PLUGIN_NAME }} - if [ -f "styles.css" ]; then - cp styles.css ${{ env.PLUGIN_NAME }} - fi - zip -r ${{ env.PLUGIN_NAME }}-${{ steps.version.outputs.version }}.zip ${{ env.PLUGIN_NAME }} - - - name: Create source packages - run: | - # 创建临时目录 - mkdir temp_source - # 复制所有文件到临时目录,排除不需要的文件 - rsync -av --exclude='node_modules' --exclude='${{ env.PLUGIN_NAME }}' --exclude='*.zip' . temp_source/ - - # 从临时目录创建压缩包 - cd temp_source - zip -r ../source-code.zip . - tar czf ../source-code.tar.gz . - cd .. - - # 清理临时目录 - rm -rf temp_source + npm install + npm run build - name: Create release env: @@ -76,7 +32,7 @@ jobs: tag="${GITHUB_REF#refs/tags/}" files=() - for file in main.js manifest.json; do + for file in main.js manifest.json styles.css; do if [ -f "$file" ]; then files+=("$file") else @@ -88,4 +44,4 @@ jobs: gh release create "$tag" \ --title="$tag" \ --draft \ - "${files[@]}" + "${files[@]}" \ No newline at end of file