-
Notifications
You must be signed in to change notification settings - Fork 4
42 lines (42 loc) · 1.17 KB
/
ci.yml
File metadata and controls
42 lines (42 loc) · 1.17 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
name: CI
on: [push, pull_request]
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET Core
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Restore packages
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
build-image:
name: Build & Push (Docker)
needs: build-test
runs-on: ubuntu-latest
env:
dockerId: ${{ secrets.dockerid }}
dockerPassword: ${{ secrets.dockerpassword }}
imageName: openrct2/openrct2.api
fullbranch: ${{ github.ref }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build image
run: docker build -t "$imageName" .
- name: Push image
run: |
branch=$(echo $fullbranch | sed 's/refs\/heads\///')
echo "Current branch is $branch"
if [ $branch == 'master' ]; then
docker login -u "$dockerId" -p "$dockerPassword"
docker push "$imageName"
else
echo 'Image not pushed'
fi