forked from newrelic/k8s-agents-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (96 loc) · 4.76 KB
/
publish-newrelic-instrumentation-dotnet-windows.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
99
100
101
102
103
104
105
106
107
108
109
110
111
name: "Publish Dotnet Newrelic-Instrumentation for Windows"
on:
push:
paths:
- 'src/apm/dotnet_windows/**'
- '.github/workflows/publish-newrelic-instrumentation-dotnet-windows.yml'
branches:
- main
pull_request:
paths:
- 'src/apm/dotnet_windows/**'
- '.github/workflows/publish-newrelic-instrumentation-dotnet-windows.yml'
workflow_dispatch:
jobs:
read-version:
name: Read Version
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Read version
id: get_version
run: |
VERSION=$(cat src/apm/dotnet_windows/version.txt)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
build-publish-containers:
name: Build and Publish Containers
runs-on: ${{ matrix.os }}
needs: read-version
strategy:
max-parallel: 2
matrix:
os: [windows-2019, windows-2022]
include:
- os: windows-2019
base: ltsc2019
file: src/apm/dotnet_windows/Dockerfile.windows
tag: ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows-ltsc2019-amd64:${{ needs.read-version.outputs.VERSION }}
- os: windows-2022
base: ltsc2022
file: src/apm/dotnet_windows/Dockerfile.windows
tag: ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows-ltsc2022-amd64:${{ needs.read-version.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to GitHub Package Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.K8S_AGENTS_GHCR_TOKEN }}
- name: Build and Push Docker image
run: |
docker build -f ${{ matrix.file }} --build-arg BASE=${{ matrix.base }} --build-arg VERSION=${{ needs.read-version.outputs.VERSION }} -t ${{ matrix.tag }} .
docker push ${{ matrix.tag }}
publish-manifest:
name: Publish Manifest
runs-on: ubuntu-latest
needs: build-publish-containers
steps:
- name: Checkout
uses: actions/checkout@v3
# Redundant GITHUB_OUTPUT will not propigate to this job
- name: Read version
id: get_version
run: |
VERSION=$(cat src/apm/dotnet_windows/version.txt)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Login to GitHub Package Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.K8S_AGENTS_GHCR_TOKEN }}
- name: Docker Manifest
run: |
docker manifest create ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows:${{ env.VERSION }} \
--amend ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows-ltsc2019-amd64:${{ env.VERSION }} \
--amend ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows-ltsc2022-amd64:${{ env.VERSION }}
docker manifest create ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows:latest \
--amend ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows-ltsc2019-amd64:${{ env.VERSION }} \
--amend ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows-ltsc2022-amd64:${{ env.VERSION }}
- name: Docker Annotate
run: |
docker manifest annotate --os windows --arch amd64 \
--os-version "10.0.17763.6414" \
ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows:${{ env.VERSION }} ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows-ltsc2019-amd64:${{ env.VERSION }}
docker manifest annotate --os windows --arch amd64 \
--os-version "10.0.20348.2762" \
ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows:${{ env.VERSION }} ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows-ltsc2022-amd64:${{ env.VERSION }}
- name: Docker Push Manifest
run: |
docker manifest push ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows:${{ env.VERSION }}
docker manifest push ghcr.io/${{ github.repository_owner }}/k8s-agents-operator-windows/newrelic-dotnet-init-windows:latest