-
Notifications
You must be signed in to change notification settings - Fork 45
98 lines (93 loc) · 3.08 KB
/
dotnet.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: .NET
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
BuildDebugAndTest:
runs-on: ubuntu-latest
name: "Run Tests"
steps:
- uses: actions/checkout@v2
- name: update dotnet core sdk
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: dotnet restore (first try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (second try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (last try)
run: dotnet restore
- name: dotnet build Debug
run: dotnet build --no-restore --configuration Debug
- name: dotnet test
run: dotnet test --no-build --verbosity normal Tests/Tests.csproj
BuildRelease:
runs-on: ubuntu-latest
name: "Build Release"
steps:
- uses: actions/checkout@v2
- name: update dotnet core sdk
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: dotnet restore (first try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (second try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (last try)
run: dotnet restore
- name: dotnet build Release
run: dotnet build --no-restore --configuration Release
ConfigTest:
runs-on: ubuntu-latest
outputs:
docker-username: ${{ steps.docker-username.outputs.defined }}
steps:
- id: docker-username
env:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
if: "${{ env.DOCKER_USERNAME }}"
run: echo "::set-output name=defined::true"
DockerImage:
needs: [BuildDebugAndTest, BuildRelease, ConfigTest]
runs-on: ubuntu-latest
name: "Build Docker image"
if: (github.ref == 'refs/heads/master') && (needs.ConfigTest.outputs.docker-username == 'true')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "clean build artifacts"
run: git clean -dfx
- name: update dotnet core sdk
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: dotnet restore (first try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (second try)
run: dotnet restore --ignore-failed-sources
- name: dotnet restore (last try)
run: dotnet restore
- name: dotnet build Release
run: dotnet build --no-restore --configuration Release
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Generating build ID with offset for old builds
env:
NUM: ${{ github.run_number }}
run: echo "GITHUB_RUN_NUMBER_WITH_OFFSET=$(($NUM+1050))" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: 'true'
tags: rpcs3/discord-bot:${{ env.GITHUB_RUN_NUMBER_WITH_OFFSET }},rpcs3/discord-bot:release-latest,rpcs3/discord-bot:latest