-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (125 loc) · 4.48 KB
/
dotnet.yml
File metadata and controls
133 lines (125 loc) · 4.48 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: CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
VERSION_PREFIX: 3.6.${{ github.run_number }}
VERSION_REV: ${{ github.run_attempt }}
VERSION_HASH: +${{ github.sha }}
BUILD_CONF: Release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
working-directory: src
- name: Build
run: dotnet build -c $BUILD_CONF --no-restore -p:Version=${VERSION_PREFIX}${VERSION_REV}${VERSION_HASH} -p:FileVersion=${VERSION_PREFIX}.${VERSION_REV} -p:ContinuousIntegrationBuild=true
working-directory: src
- name: Upload NuGet package
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: '**/*.nupkg'
retention-days: 5
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Install astrometry.net
run: sudo apt-get update && sudo apt-get install -y astrometry.net astrometry-data-2mass-08-19
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
working-directory: src
- name: Build
run: dotnet build -c $BUILD_CONF --no-restore -p:Version=${VERSION_PREFIX}${VERSION_REV}${VERSION_HASH} -p:FileVersion=${VERSION_PREFIX}.${VERSION_REV} -p:ContinuousIntegrationBuild=true
working-directory: src
- name: Test
run: dotnet test -c $BUILD_CONF --no-build
working-directory: src
publish-apps:
needs: test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
strategy:
fail-fast: false
matrix:
include:
- { os: windows-latest, rid: win-x64 }
- { os: windows-latest, rid: win-arm64 }
- { os: ubuntu-latest, rid: linux-x64 }
- { os: ubuntu-24.04-arm, rid: linux-arm64 }
- { os: macos-latest, rid: osx-arm64 }
- { os: macos-latest, rid: osx-x64 }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Publish TianWen.Lib.CLI
run: dotnet publish src/TianWen.Lib.CLI/TianWen.Lib.CLI.csproj -r ${{ matrix.rid }} -c Release -p:Version=${VERSION_PREFIX}${VERSION_REV}${VERSION_HASH} -p:FileVersion=${VERSION_PREFIX}.${VERSION_REV} -p:GeneratePackageOnBuild=false
shell: bash
- name: Publish TianWen.UI.FitsViewer
run: dotnet publish src/TianWen.UI.FitsViewer/TianWen.UI.FitsViewer.csproj -r ${{ matrix.rid }} -c Release -p:Version=${VERSION_PREFIX}${VERSION_REV}${VERSION_HASH} -p:FileVersion=${VERSION_PREFIX}.${VERSION_REV} -p:GeneratePackageOnBuild=false
shell: bash
- uses: actions/upload-artifact@v4
with:
name: tianwen-cli-${{ matrix.rid }}
path: src/TianWen.Lib.CLI/bin/Release/net10.0/${{ matrix.rid }}/publish/
- uses: actions/upload-artifact@v4
with:
name: tianwen-fits-viewer-${{ matrix.rid }}
path: src/TianWen.UI.FitsViewer/bin/Release/net10.0/${{ matrix.rid }}/publish/
release:
needs: publish-apps
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create release archives
run: |
cd artifacts
for dir in tianwen-cli-* tianwen-fits-viewer-*/; do
name="${dir%/}"
tar -czf "../${name}.tar.gz" -C "$dir" .
done
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.VERSION_PREFIX }}
name: v${{ env.VERSION_PREFIX }}
generate_release_notes: true
files: |
tianwen-cli-*.tar.gz
tianwen-fits-viewer-*.tar.gz
publish-nuget:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Download NuGet packages
uses: actions/download-artifact@v4
with:
name: nuget-packages
- name: Push NuGet package
run: dotnet nuget push **/*.nupkg -s nuget.org -k ${{ secrets.NUGET_API_KEY }}