|
| 1 | +# Licensed under the Apache License v. 2 (the "License") |
| 2 | +# You may not use this file except in compliance with the License. |
| 3 | +# You may obtain a copy of the License at |
| 4 | +# |
| 5 | +# https://www.apache.org/licenses/LICENSE-2.0.html |
| 6 | +# |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | +# See the License for the specific language governing permissions and |
| 11 | +# limitations under the License. |
| 12 | +# |
| 13 | +# Copyright (C) 2025-2025 xqyjlj<xqyjlj@126.com> |
| 14 | +# |
| 15 | +# @author xqyjlj |
| 16 | +# @file windows.yml |
| 17 | +# |
| 18 | +# Change Logs: |
| 19 | +# Date Author Notes |
| 20 | +# ------------ ---------- ----------------------------------------------- |
| 21 | +# 2025-10-21 xqyjlj initial version |
| 22 | +# |
| 23 | + |
| 24 | +name: windows |
| 25 | + |
| 26 | +on: |
| 27 | + push: |
| 28 | + pull_request: |
| 29 | + |
| 30 | +concurrency: |
| 31 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 32 | + cancel-in-progress: true |
| 33 | + |
| 34 | +jobs: |
| 35 | + release: |
| 36 | + name: ⬆️ release |
| 37 | + runs-on: windows-latest |
| 38 | + if: startsWith(github.ref, 'refs/tags/') |
| 39 | + env: |
| 40 | + CI_PROJECT_DIR: ${{ github.workspace }} |
| 41 | + GITHUB_CSPLINK_DEVELOPER_TOKEN: ${{ github.token }} |
| 42 | + steps: |
| 43 | + - name: ⬇️ checkout csp |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + submodules: recursive |
| 47 | + fetch-depth: 1 |
| 48 | + |
| 49 | + - name: 📦 Setup pnpm |
| 50 | + uses: pnpm/action-setup@v4 |
| 51 | + |
| 52 | + - name: 📦 Setup node |
| 53 | + uses: actions/setup-node@v4 |
| 54 | + with: |
| 55 | + node-version: 22 |
| 56 | + |
| 57 | + - name: 📦 setup python |
| 58 | + uses: actions/setup-python@v5 |
| 59 | + with: |
| 60 | + python-version: 3.10.11 |
| 61 | + |
| 62 | + - name: 👷 Install |
| 63 | + shell: bash |
| 64 | + run: | |
| 65 | + pnpm install --frozen-lockfile --no-verify-store-integrity |
| 66 | + pnpm server:install |
| 67 | +
|
| 68 | + - name: 🔨 Build |
| 69 | + shell: bash |
| 70 | + run: | |
| 71 | + pnpm release |
| 72 | +
|
| 73 | + CSP_VERSION=$(npm pkg get version | tr -d '"') |
| 74 | + mv -v release/${CSP_VERSION}/csp-Windows-${CSP_VERSION}-Setup.exe csp-windows-setup-${{ github.ref_name }}.exe |
| 75 | + pushd release/${CSP_VERSION}/ |
| 76 | + mv -v win-unpacked csp-windows-portable-${{ github.ref_name }} |
| 77 | + 7z a csp-windows-portable-${{ github.ref_name }}.zip csp-windows-portable-${{ github.ref_name }} |
| 78 | + popd |
| 79 | + mv -v release/${CSP_VERSION}/csp-windows-portable-${{ github.ref_name }}.zip csp-windows-portable-${{ github.ref_name }}.zip |
| 80 | + mv -v build-server/csp-server.exe csp-windows-server-${{ github.ref_name }}.exe |
| 81 | + - name: ⬆️ create release |
| 82 | + uses: softprops/action-gh-release@v2 |
| 83 | + with: |
| 84 | + name: csp ${{ github.ref_name }} |
| 85 | + draft: true |
| 86 | + prerelease: true |
| 87 | + token: ${{ secrets.RELEASE_TOKEN }} |
| 88 | + files: | |
| 89 | + csp-windows-setup-${{ github.ref_name }}.exe |
| 90 | + csp-windows-portable-${{ github.ref_name }}.zip |
| 91 | + csp-windows-server-${{ github.ref_name }}.exe |
0 commit comments