-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (113 loc) · 4.2 KB
/
dotnet_build_release.yml
File metadata and controls
133 lines (113 loc) · 4.2 KB
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
name: Build & Publish
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest ]
arch: [ x64, x86, arm64 ]
exclude:
- os: macos-latest
arch: x86
- os: windows-latest
arch: x86
- os: ubuntu-latest
arch: x86
- os: ubuntu-latest
arch: arm64
steps:
# Checkout the repo
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Build solution (Windows)
if: matrix.os == 'windows-latest' && matrix.arch == 'x64'
run: dotnet build RedSeaMarkupLanguage.slnx -c Release -p:Platform=${{ matrix.arch }}
- name: Build solution (Linux and MacOS)
if: matrix.os != 'windows-latest'
run: dotnet build RedSeaMarkupLanguage.slnx -c Release -p:Platform=${{ matrix.arch }}
- name: Run tests
run: dotnet test ./tests/RSML.Tests.csproj -c Release --no-build
- name: Pack & push to NuGet
if: github.event_name == 'push' && matrix.os == 'windows-latest' && matrix.arch == 'x64'
shell: pwsh
run: |
ls .
dotnet pack ./src/RSML/RSML.csproj -c Release -o ./nupkg
ls .
ls ./nupkg/
Get-ChildItem -Path ./nupkg -Filter *.nupkg | ForEach-Object {
dotnet nuget push $_.FullName `
--api-key ${{ secrets.NUGET_API_KEY }} `
--source https://api.nuget.org/v3/index.json `
--skip-duplicate
}
- name: Publish CLI archives (Windows)
if: matrix.os == 'windows-latest' && matrix.arch == 'x64'
shell: pwsh
run: |
dotnet publish ./src/RSML.CLI/RSML.CLI.csproj -c Release -r win-${{ matrix.arch }} --self-contained true -o publish
cd publish
Compress-Archive -Path * -DestinationPath ../RSML.CLI-windows-latest-${{ matrix.arch }}.zip
tar -czf ../RSML.CLI-windows-latest-${{ matrix.arch }}.tar.gz *
cd ..
- name: Publish CLI archives (Linux and MacOS)
if: matrix.os != 'windows-latest'
shell: bash
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
RID="linux-${{ matrix.arch }}"
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
RID="osx-${{ matrix.arch }}"
fi
dotnet publish ./src/RSML.CLI/RSML.CLI.csproj -c Release -r $RID --self-contained true -o publish
cd publish
zip -r ../RSML.CLI-${{ matrix.os }}-${{ matrix.arch }}.zip .
tar -czf ../RSML.CLI-${{ matrix.os }}-${{ matrix.arch }}.tar.gz .
cd ..
- name: Upload CLI artifacts (Windows)
if: matrix.os == 'windows-latest' && matrix.arch == 'x64'
uses: actions/upload-artifact@v4
with:
name: cli-windows-${{ matrix.arch }}
path: |
RSML.CLI-windows-latest-${{ matrix.arch }}.zip
RSML.CLI-windows-latest-${{ matrix.arch }}.tar.gz
- name: Upload CLI artifacts (Linux/macOS)
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.os }}-${{ matrix.arch }}
path: |
RSML.CLI-${{ matrix.os }}-${{ matrix.arch }}.zip
RSML.CLI-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
- uses: actions/checkout@v4
release:
name: Create GitHub Release
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download CLI archives
uses: actions/download-artifact@v4
with:
path: ./release-assets
- name: Display downloaded files
run: ls -R ./release-assets
- name: Upload release artifacts
uses: softprops/action-gh-release@v2
with:
name: Red Sea Markup Language ${{ github.ref_name }}
generate_release_notes: true
files: |
./release-assets/**/**/*.zip
./release-assets/**/**/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4