-
Notifications
You must be signed in to change notification settings - Fork 496
185 lines (172 loc) · 7.2 KB
/
update-Dockerfiles.yml
File metadata and controls
185 lines (172 loc) · 7.2 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Update Lambda Dockerfiles
permissions:
contents: write
pull-requests: write
on:
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
NET_8_AMD64:
description: ".NET 8 AMD64"
type: boolean
required: true
default: true
NET_8_ARM64:
description: ".NET 8 ARM64"
type: boolean
required: true
default: true
NET_8_NEXT_VERSION:
description: ".NET 8 Next Version"
type: string
required: true
NET_9_AMD64:
description: ".NET 9 AMD64"
type: boolean
required: true
default: true
NET_9_ARM64:
description: ".NET 9 ARM64"
type: boolean
required: true
default: true
NET_9_NEXT_VERSION:
description: ".NET 9 Next Version"
type: string
required: true
NET_10_AMD64:
description: ".NET 10 AMD64"
type: boolean
required: true
default: true
NET_10_ARM64:
description: ".NET 10 ARM64"
type: boolean
required: true
default: true
NET_10_NEXT_VERSION:
description: ".NET 10 Next Version"
type: string
required: true
jobs:
build:
runs-on: ubuntu-latest
env:
NET_8_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net8/amd64/Dockerfile"
NET_8_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net8/arm64/Dockerfile"
NET_9_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net9/amd64/Dockerfile"
NET_9_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile"
NET_10_AMD64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile"
NET_10_ARM64_Dockerfile: "LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 #v4.2.2
with:
ref: 'dev'
- name: Update .NET 8 AMD64
id: update-net8-amd64
shell: pwsh
env:
DOCKERFILE_PATH: ${{ env.NET_8_AMD64_Dockerfile }}
NEXT_VERSION: ${{ github.event.inputs.NET_8_NEXT_VERSION }}
run: |
.\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}"
if: ${{ github.event.inputs.NET_8_AMD64 == 'true' }}
- name: Update .NET 8 ARM64
id: update-net8-arm64
shell: pwsh
env:
DOCKERFILE_PATH: ${{ env.NET_8_ARM64_Dockerfile }}
NEXT_VERSION: ${{ github.event.inputs.NET_8_NEXT_VERSION }}
run: |
.\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}"
if: ${{ github.event.inputs.NET_8_ARM64 == 'true' }}
- name: Update .NET 9 AMD64
id: update-net9-amd64
shell: pwsh
env:
DOCKERFILE_PATH: ${{ env.NET_9_AMD64_Dockerfile }}
NEXT_VERSION: ${{ github.event.inputs.NET_9_NEXT_VERSION }}
run: |
.\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}"
if: ${{ github.event.inputs.NET_9_AMD64 == 'true' }}
- name: Update .NET 9 ARM64
id: update-net9-arm64
shell: pwsh
env:
DOCKERFILE_PATH: ${{ env.NET_9_ARM64_Dockerfile }}
NEXT_VERSION: ${{ github.event.inputs.NET_9_NEXT_VERSION }}
run: |
.\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}"
if: ${{ github.event.inputs.NET_9_ARM64 == 'true' }}
- name: Update .NET 10 AMD64
id: update-net10-amd64
shell: pwsh
env:
DOCKERFILE_PATH: ${{ env.NET_10_AMD64_Dockerfile }}
NEXT_VERSION: ${{ github.event.inputs.NET_10_NEXT_VERSION }}
run: |
.\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}"
if: ${{ github.event.inputs.NET_10_AMD64 == 'true' }}
- name: Update .NET 10 ARM64
id: update-net10-arm64
shell: pwsh
env:
DOCKERFILE_PATH: ${{ env.NET_10_ARM64_Dockerfile }}
NEXT_VERSION: ${{ github.event.inputs.NET_10_NEXT_VERSION }}
run: |
.\LambdaRuntimeDockerfiles\update-dockerfile.ps1 -DockerfilePath "${{ env.DOCKERFILE_PATH }}" -NextVersion "${{ env.NEXT_VERSION }}"
if: ${{ github.event.inputs.NET_10_ARM64 == 'true' }}
# Update Dockerfiles if newer version of ASP.NET Core is available
- name: Commit and Push
id: commit-push
shell: pwsh
run: |
git config --global user.email "github-aws-sdk-dotnet-automation@amazon.com"
git config --global user.name "aws-sdk-dotnet-automation"
$suffix=Get-Date -Format yyyy-mm-dd-HH-mm
$branch="chore/update-Dockerfiles-${suffix}"
git checkout -b $branch
git add "**/*Dockerfile"
git commit -m "chore: ASP.NET Core version update in Dockerfiles"
git push origin $branch
Add-Content -Path $env:GITHUB_OUTPUT -Value "BRANCH=$branch"
# Create a Pull Request from the pushed branch
- name: Pull Request
id: pull-request
if: ${{ steps.commit-push.outputs.BRANCH }}
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ steps.commit-push.outputs.BRANCH }}
destination_branch: "dev"
pr_title: 'chore: ASP.NET Core version update in Dockerfiles'
pr_body: "This PR updates the Dockerfiles to use the latest ASP.NET Core version.
Verify listed Dockerfiles that they have correct version and matching SHA512 checksum for ASP.NET Core runtime.
\n\nAll .NET versions https://dotnet.microsoft.com/en-us/download/dotnet
\n\n*Description of changes:*
\n${{ format
(
'{0}\n{1}\n{2}\n{3}\n{4}\n{5}',
join(steps.update-net8-amd64.outputs.MESSAGE, '\n'),
join(steps.update-net8-arm64.outputs.MESSAGE, '\n'),
join(steps.update-net9-amd64.outputs.MESSAGE, '\n'),
join(steps.update-net9-arm64.outputs.MESSAGE, '\n'),
join(steps.update-net10-amd64.outputs.MESSAGE, '\n'),
join(steps.update-net10-arm64.outputs.MESSAGE, '\n')
)
}}"
github_token: ${{ secrets.GITHUB_TOKEN }}
# Add "Release Not Needed" label to the PR
- name: Add Release Not Needed label
if: ${{ steps.pull-request.outputs.pr_number }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ steps.pull-request.outputs.pr_number }},
labels: ['Release Not Needed']
})