Repository navigation
119 lines (113 loc) · 5.34 KB
/
Copy pathdotnet.yml
File metadata and controls
119 lines (113 loc) · 5.34 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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
if: github.event_name == 'push'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set Docker image tags
id: docker_tags
run: |
image="ghcr.io/${GITHUB_REPOSITORY,,}"
echo "image=${image}" >> "$GITHUB_OUTPUT"
echo "commit_hash=${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Build single file linux-x64
run: dotnet publish KekUploadServer -c release -r linux-x64 -p:PublishSingleFile=true --self-contained true --verbosity Normal -p:PublishTrimmed=True -p:EnableCompressionInSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
- name: Build single file linux-arm64
run: dotnet publish KekUploadServer -c release -r linux-arm64 -p:PublishSingleFile=true --self-contained true --verbosity Normal -p:PublishTrimmed=True -p:EnableCompressionInSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
- name: Build single file macos-x64 (Intel)
run: dotnet publish KekUploadServer -c release -r osx-x64 -p:PublishSingleFile=true --self-contained true --verbosity Normal -p:PublishTrimmed=True -p:EnableCompressionInSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
- name: Build single file macos-arm64 (Apple Silicon)
run: dotnet publish KekUploadServer -c release -r osx-arm64 -p:PublishSingleFile=true --self-contained true --verbosity Normal -p:PublishTrimmed=True -p:EnableCompressionInSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
- name: Build single file windows-x64
run: dotnet publish KekUploadServer -c release -r win-x64 -p:PublishSingleFile=true --self-contained true --verbosity Normal -p:PublishTrimmed=True -p:EnableCompressionInSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
- name: Build single file windows-arm64
run: dotnet publish KekUploadServer -c release -r win-arm64 -p:PublishSingleFile=true --self-contained true --verbosity Normal -p:PublishTrimmed=True -p:EnableCompressionInSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
- name: Upload single file build linux-x64
uses: actions/upload-artifact@v7
with:
name: KekUploadServer-linux-x64
path: KekUploadServer/bin/release/net10.0/linux-x64/publish/KekUploadServer
- name: Upload single file build linux-arm64
uses: actions/upload-artifact@v7
with:
name: KekUploadServer-linux-arm64
path: KekUploadServer/bin/release/net10.0/linux-arm64/publish/KekUploadServer
- name: Upload single file build osx-x64
uses: actions/upload-artifact@v7
with:
name: KekUploadServer-macos-x64
path: KekUploadServer/bin/release/net10.0/osx-x64/publish/KekUploadServer
- name: Upload single file build osx-arm64
uses: actions/upload-artifact@v7
with:
name: KekUploadServer-macos-arm64
path: KekUploadServer/bin/release/net10.0/osx-arm64/publish/KekUploadServer
- name: Upload single file build windows-x64
uses: actions/upload-artifact@v7
with:
name: KekUploadServer-windows-x64
path: KekUploadServer/bin/release/net10.0/win-x64/publish/KekUploadServer.exe
- name: Upload single file build windows-arm64
uses: actions/upload-artifact@v7
with:
name: KekUploadServer-windows-arm64
path: KekUploadServer/bin/release/net10.0/win-arm64/publish/KekUploadServer.exe
- name: Build and push Docker image
if: github.event_name == 'push'
uses: docker/build-push-action@v7
with:
context: .
file: ./KekUploadServer/Dockerfile
push: true
tags: |
${{ steps.docker_tags.outputs.image }}:${{ steps.docker_tags.outputs.commit_hash }}
${{ steps.docker_tags.outputs.image }}:dev
- name: Build Docker image artifact
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v7
with:
context: .
file: ./KekUploadServer/Dockerfile
push: false
outputs: type=docker,dest=/tmp/kekuploadserver-image.tar
tags: |
${{ steps.docker_tags.outputs.image }}:${{ steps.docker_tags.outputs.commit_hash }}
${{ steps.docker_tags.outputs.image }}:dev
- name: Compress Docker image artifact
if: github.event_name == 'pull_request'
run: gzip -f /tmp/kekuploadserver-image.tar
- name: Upload Docker image artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v7
with:
name: kekuploadserver-image
path: /tmp/kekuploadserver-image.tar.gz