-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (74 loc) · 2.8 KB
/
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
name: release
# TODO
# - Get AssemblyName, TargetFramework (TFM), RuntimeIdentifier (RID) from Directory.Build.props, *.csproj
# - Overwrite `$env:RID and `$env:TFM with build props, allowing workflows to be driven by the project(s)
# - support multiple ASSEMBLYNAME parameters for matrices
on:
push:
branches: [ main, develop ]
paths-ignore:
- ".github/**/*.*"
- "**/*.md"
- "**/*.txt"
jobs:
build:
name: Build
runs-on: windows-latest
env:
RID: "win-x86"
TFM: "net5.0-windows"
ASSEMBLYNAME: "SPV3.Loader"
PROJPATH: "./src/${{ env.ASSEMBLYNAME }}.csproj"
steps:
################
# SETUP
################
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required by GitVersion
submodules: "recursive"
- name: Setup Node
uses: actions/[email protected]
- run: npm install # Required by Semantic Release
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "6.0.x"
include-prerelease: true
- name: Add GitHub NuGet Package Repository
run: dotnet nuget add source https://nuget.pkg.github.com/HaloSPV3/index.json -n "github" -u USERNAME -p ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
- name: Set NuGet.org Credentials
run: dotnet nuget update source "nuget.org" -u USERNAME -p ${{ secrets.NUGET_TOKEN }} --store-password-in-clear-text
################
# BUILD
################
- name: dotnet-publish
run: |
dotnet publish $env:CSPROJ_RELPATH -c Release --no-self-contained -p:ContinuousIntegrationBuild=true
src/.msb.noConfig.ps1
# required variables: TargetFramework, RuntimeIdentifier, GitVersion_FullSemVer
- name: Compress-PublishArtifacts
shell: pwsh
run: |
$publishPath = Resolve-Path ".\bin\Release\$env:TFM\$env:RID\publish";
$archiveName = "$env:ASSEMBLYNAME.$env:TFM-$env:RID.$env:GitVersion_FullSemVer.zip";
Compress-Archive -Path $publishPath -DestinationPath $archiveName -CompressionLevel Optimal;
################
# RELEASE
################
# https://github.com/semantic-release/semantic-release
- name: Semantic Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_NPM_TOKEN }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: publish-artifacts
path: bin/Release/${{ env.TFM }}/${{ env.RID }}/publish
- name: Publish to GitHub Packages
working-directory: bin/Release
run: dotnet nuget push *.nupkg -s "github" -k ${{ secrets.GITHUB_TOKEN }}
- name: Publish to nuget.org
working-directory: bin/Release
run: dotnet nuget push *.nupkg -s "nuget.org" -k ${{ secrets.NUGET_TOKEN }}