Repository navigation
Commit 97a8405
authored
Publish to NuGet via trusted publishing, fix release permissions (#153)
* feat(ci): publish to NuGet via trusted publishing, fix release permissions
Exchanges the GitHub OIDC token for a nuget.org API key that lives one hour,
so no long-lived key is stored. The expired NUGET_API_KEY is what blocked
3.0.0; this removes the class of failure rather than restarting its clock.
Done inline rather than with NuGet/login, which is not on the org allow-list
and would fail at startup. One OIDC token mints exactly one key, so the
exchange sits immediately before the push.
Two fixes Didier found in review:
- The job inherited contents: read from the workflow, but its last step runs
gh release create, which needs contents: write. Neither 3.0.0 attempt reached
it — both died at the push — so it would have surfaced as a package published
to NuGet with no GitHub release. The deleted release.yml carried write-all,
which is why 2.6.0's release exists.
- gh release create had no existence guard, so a re-run after a partial failure
errored with "release already exists".
--skip-duplicate is dropped too: it made a re-tag of an already-published
version report success while publishing nothing.
* feat(ci): add a dry-run dispatch to test the nuget.org exchange
Trusted publishing matches on the workflow filename and environment, so the
exchange can only be tested from deploy.yml itself — a separate workflow would
fail to match even when everything is correct.
workflow_dispatch runs the exchange and stops before packing or publishing, and
takes an optional nuget_user input so the profile name can be tried without
editing the workflow. Tag-only steps are gated on github.ref_type.
* fix(ci): gate the release steps on the event, not the ref type
workflow_dispatch can be run against a tag, where ref_type is 'tag' but the
event is not a push. Pack and the GitHub release were gated on ref_type while
the push was gated on the event, so a dry run against a tag would have created
a release. Tags are the only push trigger, so one rule covers both.
* docs: describe trusted publishing and the dry run
Records that publishing is keyless and that the nuget.org policy matches on
repository, workflow filename and environment — renaming any of them breaks
publishing silently.
Adds the manual Deploy run as a way to check the credential path without
cutting a release, which is the gap that let an expired key sit unnoticed from
March until a release needed it.1 parent b996cf0 commit 97a8405
2 files changed
Lines changed: 102 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
8 | 18 | | |
9 | 19 | | |
10 | 20 | | |
| |||
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
| 34 | + | |
24 | 35 | | |
25 | 36 | | |
26 | 37 | | |
27 | 38 | | |
| 39 | + | |
28 | 40 | | |
29 | 41 | | |
30 | 42 | | |
| |||
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
78 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
79 | 97 | | |
80 | 98 | | |
81 | 99 | | |
| |||
102 | 120 | | |
103 | 121 | | |
104 | 122 | | |
| 123 | + | |
105 | 124 | | |
106 | 125 | | |
107 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
108 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
109 | 170 | | |
110 | 171 | | |
111 | | - | |
112 | | - | |
| 172 | + | |
113 | 173 | | |
114 | 174 | | |
| 175 | + | |
115 | 176 | | |
116 | 177 | | |
117 | 178 | | |
118 | 179 | | |
119 | | - | |
120 | | - | |
121 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
8 | 14 | | |
9 | 15 | | |
10 | 16 | | |
| |||
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
35 | 61 | | |
36 | 62 | | |
37 | 63 | | |
| |||
0 commit comments