-
-
Notifications
You must be signed in to change notification settings - Fork 5
79 lines (73 loc) · 3.38 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
name: Create release assets
on:
release:
types:
- created
jobs:
release:
name: Build release and publish assets
runs-on: ubuntu-latest
container: mono:latest
steps:
- name: Installing build dependencies
run: apt-get update && apt-get install -y wget jq
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7'
- name: Restore, build, and test
run: |
msbuild -r -p:configuration=Debug -p:TargetFramework=net48
dotnet build -f net7.0
- name: Smoke test the validator outside the build dir
run: |
cp _build/KSPMMCfgValidator/Release/bin/net48/Repack/KSPMMCfgValidator.exe .
chmod a+x KSPMMCfgValidator.exe
mono ./KSPMMCfgValidator.exe
- name: Get release data
id: release_data
run: |
echo -n 'upload_url=' >> $GITHUB_OUTPUT
curl -fsSL https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq -rM '.upload_url' >> $GITHUB_OUTPUT
echo -n 'nupkg_basename=' >> $GITHUB_OUTPUT
basename _build/KSPMMCfgParser/Release/bin/KSPMMCfgParser.*.nupkg >> $GITHUB_OUTPUT
- name: Upload parser nupkg release asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release_data.outputs.upload_url }}
asset_path: _build/KSPMMCfgParser/Release/bin/${{ steps.release_data.outputs.nupkg_basename }}
asset_name: ${{ steps.release_data.outputs.nupkg_basename }}
asset_content_type: application/vnd.microsoft.portable-executable
- name: Upload validator exe release asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release_data.outputs.upload_url }}
asset_path: _build/KSPMMCfgValidator/Release/bin/net48/Repack/KSPMMCfgValidator.exe
asset_name: KSPMMCfgValidator.exe
asset_content_type: application/vnd.microsoft.portable-executable
- name: Publish parser to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
if: env.NUGET_API_KEY
run: |
curl -o nuget.exe -L 'https://dist.nuget.org/win-x86-commandline/v5.6.0/nuget.exe'
mono nuget.exe push _build/KSPMMCfgParser/Release/bin/${{ steps.release_data.outputs.nupkg_basename }} ${{ secrets.NUGET_API_KEY }} -Source https://api.nuget.org/v3/index.json -SkipDuplicate
- name: Generate validator image and publish to Docker Hub
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
if: env.DOCKERHUB_USERNAME && env.DOCKERHUB_PASSWORD
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
mkdir -p _build/docker/KSPMMCfgValidator
cp KSPMMCfgValidator/Dockerfile _build/KSPMMCfgValidator/Release/bin/*/KSPMMCfgValidator.exe _build/docker/KSPMMCfgValidator
docker build -t kspckan/kspmmcfgvalidator:latest _build/docker/KSPMMCfgValidator
docker push kspckan/kspmmcfgvalidator:latest