pack_push #22
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and pack nuget | |
on: | |
push: | |
branches: | |
- main | |
- dev-ci-cd-github | |
tags: | |
- '*' # 触发所有tag | |
env: | |
IS_PRODUCTION: true | |
TAG: ${{ github.ref_name }} # 获取当前分支名或tag名 | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
# 注释掉缓存 | |
# - name: Cache NuGet packages | |
# uses: actions/cache@v3 | |
# with: | |
# path: ~/.nuget/packages | |
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
# restore-keys: | | |
# ${{ runner.os }}-build-nuget-${{ env.CACHE_NAME }}- | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build with dotnet | |
run: dotnet build --configuration Release | |
- name: Pack with powershell | |
shell: pwsh | |
working-directory: ./nupkg | |
run: ./pack.ps1 | |
- name: Push Nuget Package | |
working-directory: ./nupkg | |
run: ./pack_push.ps1 | |
shell: pwsh | |
- name: Push to GitHub Packages | |
run: dotnet nuget push nupkg/*.nupkg --source "github" | |
working-directory: ./nupkg/dist | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |