Skip to content

RE

RE #40

Workflow file for this run

name: Release
on:
push:
branches:
- 'main'
paths:
- 'CHANGELOG.md'
env:
GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
OWNER_NAME: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
OWNER_ID: ${{ github.event.repository.owner.node_id }}
REPO_ID: ${{ github.event.repository.node_id }}
PR_ID: ${{ github.event.pull_request.node_id }}
PROJECT_NAME: ${{ github.event.repository.name }}_VNext
concurrency: ci-${{ github.ref }}
jobs:
#Get Version
prepare_check:
runs-on: ubuntu-latest
env:
WORKER_NAME: VERSION_SCANNER
outputs:
releaseVersion: ${{steps.scanner.outputs.RELEASE_VERSION}}
releasePackString: ${{steps.outter.outputs.RELEASE_PACK_STRING}}
hasNugetKey: ${{steps.outter.outputs.HAS_NUGET_KEY}}
hasCoverageKey: ${{steps.outter.outputs.HAS_COVERAGE_KEY}}
steps:
- uses: actions/checkout@v4
#- name: 🔨 Setup .NET 6.X SDK
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: '6.x'
- name: 📡 Scan Prepare Enviroment
id: scanner
run: dotnet test './test/workflow/Workflow.Runner' --nologo -c Release
- name: 🙂 Output ReleaseVersion
id: outter
run: |
if [ "${{ steps.scanner.outputs.RELEASE_VERSION }}" == "" ]; then
echo "未扫描到版本号,请核对 CHANGELOD 文档!"
exit 1
fi
echo "RELEASE_PACK_STRING=${{github.event.repository.name}}_Release_v${{ steps.scanner.outputs.RELEASE_VERSION }}" >> "$GITHUB_OUTPUT"
if [ "${{ secrets.NUGET_KEY }}" == "" ]; then
echo "HAS_NUGET_KEY=false" >> $GITHUB_OUTPUT
else
echo "HAS_NUGET_KEY=true" >> $GITHUB_OUTPUT
fi
#Archive Project
archive_project:
runs-on: ubuntu-latest
needs: prepare_check
env:
GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
PROJECT_ARCHIVE_NAME: ${{ needs.prepare_check.outputs.releasePackString }}
WORKER_NAME: PROJECT_ARCHIVE
steps:
- uses: actions/checkout@v4
#- name: 🔨 Setup .NET 6.X SDK
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: '6.x'
- name: 📄 Achive Project
run: dotnet test './test/workflow/Workflow.Runner' --nologo -c Release
publish:
runs-on: ubuntu-latest
needs: prepare_check
steps:
- uses: actions/checkout@v4
- name: 🔨 Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x
9.0.x
- name: ✊ Release Dll
run: dotnet build -c Release
- name: 🚦 Check & Pack Nuget
run: dotnet test './test/workflow/Workflow.Nuget.Publish' --nologo --no-restore --no-build -c Release
- name: 📶 Push to Nuget
if: ${{ needs.prepare_check.outputs.hasNugetKey == 'true' }}
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate