-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (76 loc) · 4.13 KB
/
native.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
# This workflow runs when recieving a "update-libpinmame"
# repository_dispatch event from vpinball/pinmame.
name: Native
on:
repository_dispatch:
types: [ update-libpinmame ]
jobs:
version:
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.version.outputs.semver }}
exists: ${{ steps.version.outputs.exists }}
steps:
- id: version
run: |
VERSION=$(npx semver -c ${{ github.event.client_payload.version }})
SEMVER="${VERSION}-preview.${{ github.event.client_payload.revision }}"
EXISTS=$(if [[ $(curl https://api.nuget.org/v3-flatcontainer/pinmame.native/index.json | grep \"${SEMVER}\") ]]; then echo "true"; else echo "false"; fi)
echo "::set-output name=semver::${SEMVER}"
echo "::set-output name=exists::${EXISTS}"
build-nuget:
runs-on: ubuntu-latest
needs: [ version ]
steps:
- uses: nuget/setup-nuget@v1
- uses: actions/checkout@v2
- uses: dawidd6/action-download-artifact@v2
with:
workflow: libpinmame
run_id: ${{ github.event.client_payload.run_id }}
repo: vpinball/pinmame
path: native/nuget
- name: Pack
run: |
cd native/nuget
mv libpinmame-*-win-x64 libpinmame-win-x64
mv libpinmame-*-win-x86 libpinmame-win-x86
mv libpinmame-*-osx-x64 libpinmame-osx-x64
mv libpinmame-*-osx-arm64 libpinmame-osx-arm64
mv libpinmame-*-osx libpinmame-osx
mv libpinmame-*-ios-arm64 libpinmame-ios-arm64
mv libpinmame-*-linux-x64 libpinmame-linux-x64
mv libpinmame-*-android-arm64-v8a libpinmame-android-arm64-v8a
sed -i 's/__VERSION__/${{ needs.version.outputs.semver }}/g' *.nuspec
nuget pack PinMame.Native.win-x64.nuspec -OutputDirectory nupkg
nuget pack PinMame.Native.win-x86.nuspec -OutputDirectory nupkg
nuget pack PinMame.Native.osx-x64.nuspec -OutputDirectory nupkg
nuget pack PinMame.Native.osx-arm64.nuspec -OutputDirectory nupkg
nuget pack PinMame.Native.osx.nuspec -OutputDirectory nupkg
nuget pack PinMame.Native.ios-arm64.nuspec -OutputDirectory nupkg
nuget pack PinMame.Native.linux-x64.nuspec -OutputDirectory nupkg
nuget pack PinMame.Native.android-arm64-v8a.nuspec -OutputDirectory nupkg
nuget pack PinMame.Native.nuspec -OutputDirectory nupkg
- uses: actions/upload-artifact@v2
with:
name: nupkg
path: native/nuget/nupkg
publish:
runs-on: ubuntu-latest
needs: [ version, build-nuget ]
steps:
- uses: nuget/setup-nuget@v1
- uses: actions/download-artifact@v2
with:
name: nupkg
- name: Publish
run: |
nuget push PinMame.Native.${{ needs.version.outputs.semver }}.nupkg -ApiKey ${{ secrets.NUGET_KEY }} -src https://api.nuget.org/v3/index.json
nuget push PinMame.Native.win-x64.${{ needs.version.outputs.semver }}.nupkg -ApiKey ${{ secrets.NUGET_KEY }} -src https://api.nuget.org/v3/index.json
nuget push PinMame.Native.win-x86.${{ needs.version.outputs.semver }}.nupkg -ApiKey ${{ secrets.NUGET_KEY }} -src https://api.nuget.org/v3/index.json
nuget push PinMame.Native.osx-x64.${{ needs.version.outputs.semver }}.nupkg -ApiKey ${{ secrets.NUGET_KEY }} -src https://api.nuget.org/v3/index.json
nuget push PinMame.Native.osx-arm64.${{ needs.version.outputs.semver }}.nupkg -ApiKey ${{ secrets.NUGET_KEY }} -src https://api.nuget.org/v3/index.json
nuget push PinMame.Native.osx.${{ needs.version.outputs.semver }}.nupkg -ApiKey ${{ secrets.NUGET_KEY }} -src https://api.nuget.org/v3/index.json
nuget push PinMame.Native.ios-arm64.${{ needs.version.outputs.semver }}.nupkg -ApiKey ${{ secrets.NUGET_KEY }} -src https://api.nuget.org/v3/index.json
nuget push PinMame.Native.linux-x64.${{ needs.version.outputs.semver }}.nupkg -ApiKey ${{ secrets.NUGET_KEY }} -src https://api.nuget.org/v3/index.json
nuget push PinMame.Native.android-arm64-v8a.${{ needs.version.outputs.semver }}.nupkg -ApiKey ${{ secrets.NUGET_KEY }} -src https://api.nuget.org/v3/index.json