-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipelines-release.yml
145 lines (134 loc) · 5.1 KB
/
azure-pipelines-release.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
trigger:
- none
pr:
- none
parameters:
- name: version
displayName: Release Version
type: string
default: ''
- name: releaseNotes
displayName: Release Notes
type: string
default: ''
variables:
- name: Version
value: ${{ parameters.version }}
- group: NitroPackerSecrets
stages:
- stage: Build
jobs:
- job:
strategy:
matrix:
Linux:
imageName: 'ubuntu-latest'
artifactName: 'NitroPacker-Linux-$(Version)'
rid: 'linux-x64'
artifactPath: '$(Build.SourcesDirectory)/NitroPacker-Linux-$(Version).tar.gz'
macOS:
imageName: 'macOS-latest'
artifactName: 'NitroPacker-macOS-$(Version)'
rid: 'osx-x64'
artifactPath: '$(Build.SourcesDirectory)/NitroPacker-macOS-$(Version).tar.gz'
Windows:
imageName: 'windows-latest'
artifactName: 'NitroPacker-Windows-$(Version)'
rid: 'win-x64'
artifactPath: '$(Build.SourcesDirectory)/NitroPacker-Windows-$(Version).zip'
displayName: Build & Publish
pool:
vmImage: $(imageName)
steps:
- checkout: self
clean: true
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
projects: $(Build.SourcesDirectory)/HaroohieClub.NitroPacker.Cli/HaroohieClub.NitroPacker.Cli.csproj
arguments: '-c Release -f net8.0 -r $(rid) --self-contained /p:PublishSingleFile=true'
publishWebProjects: false
displayName: Build & Publish NitroPacker
- pwsh: |
mkdir publish
Expand-Archive -Path $(Build.SourcesDirectory)/HaroohieClub.NitroPacker.Cli/bin/Release/net8.0/$(rid)/publish.zip -DestinationPath ./publish
Push-Location publish
chmod +x ./NitroPacker
tar -czvf $(artifactPath) ./NitroPacker
Pop-Location
condition: ne(variables['imageName'], 'windows-latest')
displayName: Create tar
- pwsh: |
mkdir publish
Expand-Archive -Path $(Build.SourcesDirectory)/HaroohieClub.NitroPacker.Cli/bin/Release/net8.0/$(rid)/publish.zip .\publish
Push-Location publish
Compress-Archive -Path .\NitroPacker.exe -DestinationPath $(artifactPath)
Pop-Location
condition: eq(variables['imageName'], 'windows-latest')
displayName: Create zip
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(artifactPath)'
ArtifactName: '$(artifactName)'
publishLocation: 'Container'
displayName: Publish build artifact
- stage: Publish_Packages
dependsOn: []
jobs:
- job:
pool:
vmImage: ubuntu-latest
displayName: Build and publish nupkgs
steps:
- task: NuGetAuthenticate@1
displayName: NuGet Authenticate
- script: |
dotnet build $(Build.SourcesDirectory)/HaroohieClub.NitroPacker/HaroohieClub.NitroPacker.csproj --configuration Release
dotnet pack $(Build.SourcesDirectory)/HaroohieClub.NitroPacker/HaroohieClub.NitroPacker.csproj --output $(Build.ArtifactStagingDirectory) --configuration Release
displayName: Build and pack nupkgs
- script: dotnet nuget push --api-key $(NuGetKey) -s nuget.org $(Build.ArtifactStagingDirectory)/HaroohieClub.NitroPacker.$(Version).nupkg
displayName: NuGet push
- stage: Release
dependsOn: Build
jobs:
- job:
pool:
vmImage: ubuntu-latest
displayName: Create release
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Linux artifacts
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'NitroPacker-Linux-$(Version)'
downloadPath: '$(Build.ArtifactStagingDirectory)'
- task: DownloadBuildArtifacts@0
displayName: Download macOS artifacts
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'NitroPacker-macOS-$(Version)'
downloadPath: '$(Build.ArtifactStagingDirectory)'
- task: DownloadBuildArtifacts@0
displayName: Download Windows artifacts
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'NitroPacker-Windows-$(Version)'
downloadPath: '$(Build.ArtifactStagingDirectory)'
- pwsh: |
Move-Item -Path $(Build.ArtifactStagingDirectory)/NitroPacker-Linux-$(Version)/NitroPacker-Linux-$(Version).tar.gz -Destination $(Build.ArtifactStagingDirectory)/NitroPacker-Linux-$(Version).tar.gz
Move-Item -Path $(Build.ArtifactStagingDirectory)/NitroPacker-macOS-$(Version)/NitroPacker-macOS-$(Version).tar.gz -Destination $(Build.ArtifactStagingDirectory)/NitroPacker-macOS-$(Version).tar.gz
Move-Item -Path $(Build.ArtifactStagingDirectory)/NitroPacker-Windows-$(Version)/NitroPacker-Windows-$(Version).zip -Destination $(Build.ArtifactStagingDirectory)/NitroPacker-Windows-$(Version).zip
displayName: Move artifacts
- task: GitHubRelease@1
displayName: 'Create GitHub Release'
inputs:
gitHubConnection: 'GitHub Connection (Jonko)'
tagSource: userSpecifiedTag
tag: '$(Version)'
title: 'NitroPacker v$(Version)'
releaseNotesSource: inline
releaseNotesInline: |
${{ parameters.releaseNotes }}