This repository was archived by the owner on Oct 21, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
78 lines (71 loc) · 2.73 KB
/
Copy pathaction.yml
File metadata and controls
78 lines (71 loc) · 2.73 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
name: 'Deploy .NET 5.0 Project'
description: 'This builds, creates and saves a docker image and deploys a .NET project that follows specific conventions'
inputs:
deployment:
description: 'Typically the repo name but not required to be, used as the stem for both the Docker image name and Kubernetes deployment'
required: true
environment-tag:
description: 'Tag for the docker image, usually environment'
required: true
kube-config:
description: 'KUBE_CONFIG, encoded in base64'
required: true
namespace:
description: 'Namespace within the Kubernetes cluster'
required: true
default: 'marathon'
nuget-read-token:
description: 'Read-only nuget token, called PACKAGE_READ_GITHUB_TOKEN in Arundo'
required: true
project:
description: 'Name of project, MUST be both .csproj filename and AssemblyName property in that file)'
required: true
project-path:
description: 'Relative path to parent of project, starting from directory in which solution is located'
required: true
default: 'src'
registry:
description: 'DOCKER_REGISTRY_SERVER in Arundo'
required: true
registry-password:
description: 'DOCKER_REGISTRY_PASSWORD in Arundo'
required: true
registry-username:
description: 'DOCKER_REGISTRY_USERNAME in Arundo'
required: true
runs:
using: "composite"
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install .NET 5.0 latest
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
source-url: https://nuget.pkg.github.com/arundo/index.json
env:
NUGET_AUTH_TOKEN: ${{inputs.nuget-read-token}}
- name: publish project
run: |
cp ${{ github.action_path }}/Dockerfile .
sed -i 's/Service.dll/${{ inputs.project}}.dll/' ./Dockerfile
cd ${{inputs.project-path}}/${{inputs.project}}
dotnet publish -c release -o ../app
shell: bash
- name: Build and push Docker image to Arundo registry
uses: docker/build-push-action@v1
with:
dockerfile: 'Dockerfile'
password: ${{ inputs.registry-password }}
path: ${{inputs.project-path}}
registry: ${{ inputs.registry }}
repository: ${{ inputs.deployment }}
username: ${{ inputs.registry-username }}
tag_with_sha: true
tags: ${{ inputs.environment-tag }}
- name: Update cluster deployment with current image
run: |
echo "${{ inputs.kube-config }}" | base64 --decode > /tmp/config
export KUBECONFIG=/tmp/config
kubectl set image --namespace ${{ inputs.namespace }} deployment/${{ inputs.deployment }} ${{ inputs.deployment }}=${{ inputs.registry }}/${{ inputs.deployment }}:sha-${GITHUB_SHA:0:7}
shell: bash