-
-
Notifications
You must be signed in to change notification settings - Fork 34
131 lines (104 loc) · 3.9 KB
/
pack.yml
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Pack
on:
push:
branches:
- \d+\.x
tags:
- \d+\.\d+\.\d+
workflow_call:
secrets:
CREATE_RELEASE_PAT:
required: true
permissions:
contents: read
id-token: write
attestations: write
jobs:
pack:
runs-on: ubuntu-24.04
outputs:
semVer2: ${{ steps.nbgv.outputs.SemVer2 }}
isPreviewRelease: ${{ startsWith(steps.nbgv.outputs.PrereleaseVersionNoLeadingHyphen, 'preview') }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2
with:
fetch-depth: 0
submodules: 'true'
- name: Setup .NET
uses: actions/setup-dotnet@87b7050bc53ea08284295505d98d2aa94301e852 # 4.2.0
with:
global-json-file: global.json
dotnet-version: |
6
7
8
- name: Determine semantic version
uses: dotnet/nbgv@f088059084cb5d872e9d1a994433ca6440c2bf72 # 0.4.2
id: nbgv
- name: Replace NuGet version default value in templates
run: find -name template.json -exec sed -i "s/TEMPLATE_GREMLINQ_VERSION_DEFAULT_VALUE/${{ steps.nbgv.outputs.NuGetPackageVersion }}/g" {} \;
- name: Build
run: dotnet build ./${{ github.event.repository.name }}.sln -c Release -p:ContinuousIntegrationBuild=true
- name: Pack
run: dotnet pack ./${{ github.event.repository.name }}.sln -c Release --no-build
- name: Copy NuGet packages to artifacts
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # 4.4.0
with:
name: NuGetPackages
path: ./**/${{ github.event.repository.name }}.*.nupkg
if-no-files-found: error
- run: echo ${{ steps.nbgv.outputs.NuGetPackageVersion }} > Version
- name: Output version to artifacts
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # 4.4.0
with:
name: Version
path: Version
if-no-files-found: error
attest:
if: ${{ needs.pack.outputs.isPreviewRelease == 'false' && github.event.repository.visibility == 'public' }}
needs: [ pack ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
with:
name: NuGetPackages
- name: Attest build provenance
uses: actions/attest-build-provenance@v2
with:
subject-path: ./**/${{ github.event.repository.name }}.*.nupkg
draft-release:
needs: [ pack ]
runs-on: ubuntu-latest
outputs:
releaseUploadUrl: ${{ steps.create_release.outputs.upload_url }}
releaseUploadId: ${{ steps.create_release.outputs.id }}
steps:
- name: Draft release
id: create_release
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # 6.0.0
with:
name: ${{ github.event.repository.name }} ${{ needs.pack.outputs.semVer2 }}
prerelease: ${{ needs.pack.outputs.isPreviewRelease }}
tag: ${{ needs.pack.outputs.semVer2 }}
commitish: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.CREATE_RELEASE_PAT }}
release:
if: ${{ needs.pack.outputs.isPreviewRelease == 'false' }}
needs: [ draft-release ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
with:
name: NuGetPackages
- uses: shogo82148/actions-upload-release-asset@aac270e08f6b4547ada0b3800f88e1eb3ce9d400 # 1.7.7
with:
upload_url: ${{ needs.draft-release.outputs.releaseUploadUrl }}
asset_path: '**/${{ github.event.repository.name }}.*.nupkg'
github_token: ${{ secrets.CREATE_RELEASE_PAT }}
- uses: eregon/publish-release@01df127f5e9a3c26935118e22e738d95b59d10ce # 1.0.6
with:
release_id: ${{ needs.draft-release.outputs.releaseUploadId }}
env:
GITHUB_TOKEN: ${{ secrets.CREATE_RELEASE_PAT }}