-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (132 loc) · 5.87 KB
/
deploy.yaml
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
name: Release
on:
push:
tags:
- 'v*'
defaults:
run:
shell: bash
jobs:
metadata:
name: Collect
uses: StirlingLabs/.github/.github/workflows/metadata.yaml@main
with:
coreName: sa
build:
name: Build
needs: [ metadata ]
uses: ./.github/workflows/build.yaml
with:
project: ${{ needs.metadata.outputs.project }}
github:
name: GitHub Release
runs-on: ubuntu-latest
needs: [ metadata, build ]
steps:
- name: Get Linux Artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.metadata.outputs.project }}-Linux
path: artifacts/Linux
- name: Get macOS Artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.metadata.outputs.project }}-macOS
path: artifacts/macOS
- name: Get Windows Artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.metadata.outputs.project }}-Windows
path: artifacts/Windows
- name: Download Public Header
run: |
curl -H "Authorization: token ${{ github.token }}" \
-H 'Accept: application/vnd.github.v3.raw' \
-o artifacts/sa.h \
-L ${{ github.api_url }}/repos/${{ github.repository }}/contents/sa.h?ref=${{ github.ref_name }}
- name: Tar up files
id: tar
run: |
echo "::set-output name=filename::$filename"
tar czf $filename --directory=artifacts .
env:
filename: ${{ needs.metadata.outputs.project }}-${{ needs.metadata.outputs.fullVersion }}.tar.gz
- name: Create GitHub Release
uses: softprops/action-gh-release@v0.1.14
with:
name: ${{ needs.metadata.outputs.project }}-${{ needs.metadata.outputs.fullVersion }}
files: |
${{ steps.tar.outputs.filename }}
nuget:
name: NuPkg Release
needs: [ metadata, build ]
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- platform: Linux
runtime: linux-x64
result: libsa.so
- platform: macOS
runtime: osx
result: libsa.dylib
- platform: Windows
runtime: win-x64
result: sa.dll
fail-fast: true
env:
platform: ${{ matrix.platform }}
runtime: ${{ matrix.runtime }}
result: ${{ matrix.result }}
project: ${{ needs.metadata.outputs.project }}
steps:
- name: Get Artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.metadata.outputs.project }}-${{ matrix.platform }}
path: ${{ matrix.runtime }}
- name: Create NuSpec
run: |
text="<?xml version=\"1.0\" encoding=\"utf-8\"?>"
text="$text\n<package xmlns=\"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd\">"
text="$text\n <metadata>"
text="$text\n <id>StirlingLabs.sockaddr.Net.runtime.$runtime.$project</id>"
text="$text\n <version>$version</version>"
text="$text\n <title>$project $version</title>"
text="$text\n <description>"
text="$text\n $project provides cross-platform socket address bindings."
text="$text\n This package provides the $project library on $runtime for consumption by sockaddr.Net."
text="$text\n </description>"
text="$text\n <authors>The Stirling Labs Team</authors>"
text="$text\n <projectUrl>$homepage</projectUrl>"
text="$text\n <readme>docs/README.md</readme>"
text="$text\n <icon>images/icon.png</icon>"
text="$text\n <tags>$project library SL sockets XP sockaddr StirlingLabs IP TCP UDP $topics</tags>"
text="$text\n <license type=\"expression\">$license</license>"
text="$text\n <requireLicenseAcceptance>true</requireLicenseAcceptance>"
text="$text\n <repository type=\"git\" url=\"$gitUrl\" branch=\"$branch\" commit=\"$commit\" />"
text="$text\n </metadata>"
text="$text\n <files>"
text="$text\n <file src=\"$runtime/README.md\" target=\"docs/README.md\" />"
text="$text\n <file src=\"$runtime/SL.png\" target=\"images/icon.png\" />"
text="$text\n <file src=\"$runtime/$result\" target=\"runtimes/$runtime/native/\" />"
text="$text\n </files>"
text="$text\n</package>"
echo -e $text > $project.nuspec
cat $project.nuspec
env:
version: ${{ needs.metadata.outputs.fullVersion }}
homepage: ${{ needs.metadata.outputs.homepage }}
license: MIT
gitUrl: ${{ github.event.repository.git_url }}
branch: ${{ needs.metadata.outputs.currentBranch }}
commit: ${{ github.sha }}
topics: ${{ needs.metadata.outputs.topics }}
- name: Create NuPkg
run: |
nuget pack $project.nuspec
ls -la
- name: Upload NuPkg
run: |
dotnet nuget push *.nupkg -k ${{github.token}} -s https://nuget.pkg.github.com/${{github.repository_owner}}/index.json --no-symbols --skip-duplicate || true
dotnet nuget push *.nupkg -k ${{secrets.NUGET_STIRLINGLABS_API_KEY}} -s https://api.nuget.org/v3/index.json --no-symbols --skip-duplicate