docs: 说明 beta 发布需先配置 NuGet 可信发布
大石头 authored at 2026-12-02 08:13:05
1.63 KiB
NewLife.Cube.ArcoVue
name: publish

on:
  push:
    tags: [ v* ]
  workflow_dispatch:

permissions:
  contents: read
  packages: write
  id-token: write

jobs:
  build-publish:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v7
      with:
        fetch-depth: 0

    - name: Setup pnpm
      uses: pnpm/action-setup@v6
      with:
        version: 9

    - name: Setup node
      uses: actions/setup-node@v7
      with:
        node-version: 24
        cache: pnpm
        cache-dependency-path: NewLife.Cube.ArcoVue/web/pnpm-lock.yaml

    - name: Build web (wwwroot)
      working-directory: NewLife.Cube.ArcoVue/web
      run: |
        pnpm install --frozen-lockfile
        pnpm build

    - name: Setup dotNET
      uses: actions/setup-dotnet@v6
      with:
        dotnet-version: |
          8.x
          9.x
          10.x
          11.x

    - name: Get Version
      run: echo "VERSION=$(date '+%Y.%m%d')" >> $GITHUB_ENV

    - name: Build
      run: dotnet build 魔方ArcoVue.slnx -c Release --version-suffix ${{ env.VERSION }}

    - name: Pack
      run: dotnet pack --no-build --version-suffix ${{ env.VERSION }} -c Release -o out NewLife.Cube.ArcoVue/NewLife.Cube.ArcoVue.csproj

    - name: NuGet login (OIDC)
      id: nuget-login
      uses: NuGet/login@v1
      with:
        user: BigStone

    - name: Publish
      run: |
        dotnet nuget push ./out/*.nupkg --skip-duplicate --source https://nuget.pkg.github.com/NewLifeX/index.json --api-key ${{ github.token }}
        dotnet nuget push ./out/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }}