Repository navigation
95 lines (90 loc) · 3.23 KB
/
Copy pathrelease.yml
File metadata and controls
95 lines (90 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: NuGet Release
on:
workflow_run:
workflows: [Build and Test]
types: [completed]
branches: [main]
workflow_dispatch:
inputs:
force:
description: Retry publishing the validated version even if its completion receipt exists.
required: false
default: false
type: boolean
permissions:
contents: read
actions: read
concurrency:
group: nuget-release
cancel-in-progress: false
jobs:
source:
if: >-
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') ||
(github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' &&
github.event.workflow_run.head_repository.full_name == github.repository &&
(github.event.workflow_run.event == 'push' || github.event.workflow_run.event == 'workflow_dispatch'))
runs-on: ubuntu-24.04
outputs:
ready: ${{ steps.source.outputs.ready }}
sha: ${{ steps.source.outputs.sha }}
run_id: ${{ steps.source.outputs.run_id }}
steps:
- uses: actions/checkout@v7.0.0
with:
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
- name: Resolve successful validation of current main
id: source
env:
GH_TOKEN: ${{ github.token }}
run: python3 scripts/resolve-release-run.py
publish-nuget:
name: Publish NuGet and GitHub Release
needs: source
if: needs.source.outputs.ready == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: write
actions: read
env:
GH_TOKEN: ${{ github.token }}
RELEASE_COMMIT: ${{ needs.source.outputs.sha }}
steps:
- uses: actions/checkout@v7.0.0
with:
ref: ${{ needs.source.outputs.sha }}
fetch-depth: 0
- uses: actions/setup-dotnet@v5.4.0
with:
dotnet-version: 10.0.x
- name: Resolve package version and existing release
id: release
env:
FORCE_RELEASE: ${{ github.event_name == 'workflow_dispatch' && inputs.force }}
run: bash scripts/release.sh resolve
- name: Download the packages verified by Build and Test
if: steps.release.outputs.should_release == 'true'
uses: actions/download-artifact@v5
with:
name: packages
path: artifacts/packages
github-token: ${{ github.token }}
run-id: ${{ needs.source.outputs.run_id }}
- name: Push NuGet packages and attach GitHub Release assets
if: steps.release.outputs.should_release == 'true'
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
TAG_NAME: ${{ steps.release.outputs.tag }}
run: bash scripts/release.sh publish
- name: Verify GitHub release artifacts
if: steps.release.outputs.should_release == 'true'
run: python3 scripts/verify-release.py --allow-draft
- name: Record accepted package publication
if: steps.release.outputs.should_release == 'true'
env:
TAG_NAME: ${{ steps.release.outputs.tag }}
run: bash scripts/release.sh finalize
- name: Verify the published GitHub Release
if: steps.release.outputs.should_release == 'true'
run: python3 scripts/verify-release.py