Skip to content

Commit a2c5b8b

Browse files
committed
ci: create release PRs using autover
1 parent a2db5a9 commit a2c5b8b

File tree

36 files changed

+1997
-1521
lines changed

36 files changed

+1997
-1521
lines changed

.autover/autover.json

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
{
2+
"Projects": [
3+
{
4+
"Name": "Amazon.Lambda.Annotations",
5+
"Paths": [
6+
"Libraries/src/Amazon.Lambda.Annotations/Amazon.Lambda.Annotations.csproj",
7+
"Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Amazon.Lambda.Annotations.SourceGenerator.csproj"
8+
]
9+
},
10+
{
11+
"Name": "Amazon.Lambda.APIGatewayEvents",
12+
"Path": "Libraries/src/Amazon.Lambda.APIGatewayEvents/Amazon.Lambda.APIGatewayEvents.csproj"
13+
},
14+
{
15+
"Name": "Amazon.Lambda.ApplicationLoadBalancerEvents",
16+
"Path": "Libraries/src/Amazon.Lambda.ApplicationLoadBalancerEvents/Amazon.Lambda.ApplicationLoadBalancerEvents.csproj"
17+
},
18+
{
19+
"Name": "Amazon.Lambda.AspNetCoreServer",
20+
"Path": "Libraries/src/Amazon.Lambda.AspNetCoreServer/Amazon.Lambda.AspNetCoreServer.csproj"
21+
},
22+
{
23+
"Name": "Amazon.Lambda.AspNetCoreServer.Hosting",
24+
"Path": "Libraries/src/Amazon.Lambda.AspNetCoreServer.Hosting/Amazon.Lambda.AspNetCoreServer.Hosting.csproj"
25+
},
26+
{
27+
"Name": "Amazon.Lambda.CloudWatchEvents",
28+
"Path": "Libraries/src/Amazon.Lambda.CloudWatchEvents/Amazon.Lambda.CloudWatchEvents.csproj"
29+
},
30+
{
31+
"Name": "Amazon.Lambda.CloudWatchLogsEvents",
32+
"Path": "Libraries/src/Amazon.Lambda.CloudWatchLogsEvents/Amazon.Lambda.CloudWatchLogsEvents.csproj"
33+
},
34+
{
35+
"Name": "Amazon.Lambda.CognitoEvents",
36+
"Path": "Libraries/src/Amazon.Lambda.CognitoEvents/Amazon.Lambda.CognitoEvents.csproj"
37+
},
38+
{
39+
"Name": "Amazon.Lambda.ConfigEvents",
40+
"Path": "Libraries/src/Amazon.Lambda.ConfigEvents/Amazon.Lambda.ConfigEvents.csproj"
41+
},
42+
{
43+
"Name": "Amazon.Lambda.ConnectEvents",
44+
"Path": "Libraries/src/Amazon.Lambda.ConnectEvents/Amazon.Lambda.ConnectEvents.csproj"
45+
},
46+
{
47+
"Name": "Amazon.Lambda.Core",
48+
"Path": "Libraries/src/Amazon.Lambda.Core/Amazon.Lambda.Core.csproj"
49+
},
50+
{
51+
"Name": "Amazon.Lambda.DynamoDBEvents",
52+
"Path": "Libraries/src/Amazon.Lambda.DynamoDBEvents/Amazon.Lambda.DynamoDBEvents.csproj"
53+
},
54+
{
55+
"Name": "Amazon.Lambda.KafkaEvents",
56+
"Path": "Libraries/src/Amazon.Lambda.KafkaEvents/Amazon.Lambda.KafkaEvents.csproj"
57+
},
58+
{
59+
"Name": "Amazon.Lambda.KinesisAnalyticsEvents",
60+
"Path": "Libraries/src/Amazon.Lambda.KinesisAnalyticsEvents/Amazon.Lambda.KinesisAnalyticsEvents.csproj"
61+
},
62+
{
63+
"Name": "Amazon.Lambda.KinesisEvents",
64+
"Path": "Libraries/src/Amazon.Lambda.KinesisEvents/Amazon.Lambda.KinesisEvents.csproj"
65+
},
66+
{
67+
"Name": "Amazon.Lambda.KinesisFirehoseEvents",
68+
"Path": "Libraries/src/Amazon.Lambda.KinesisFirehoseEvents/Amazon.Lambda.KinesisFirehoseEvents.csproj"
69+
},
70+
{
71+
"Name": "Amazon.Lambda.LexEvents",
72+
"Path": "Libraries/src/Amazon.Lambda.LexEvents/Amazon.Lambda.LexEvents.csproj"
73+
},
74+
{
75+
"Name": "Amazon.Lambda.LexV2Events",
76+
"Path": "Libraries/src/Amazon.Lambda.LexV2Events/Amazon.Lambda.LexV2Events.csproj"
77+
},
78+
{
79+
"Name": "Amazon.Lambda.Logging.AspNetCore",
80+
"Path": "Libraries/src/Amazon.Lambda.Logging.AspNetCore/Amazon.Lambda.Logging.AspNetCore.csproj"
81+
},
82+
{
83+
"Name": "Amazon.Lambda.MQEvents",
84+
"Path": "Libraries/src/Amazon.Lambda.MQEvents/Amazon.Lambda.MQEvents.csproj"
85+
},
86+
{
87+
"Name": "Amazon.Lambda.PowerShellHost",
88+
"Path": "Libraries/src/Amazon.Lambda.PowerShellHost/Amazon.Lambda.PowerShellHost.csproj"
89+
},
90+
{
91+
"Name": "Amazon.Lambda.RuntimeSupport",
92+
"Path": "Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj"
93+
},
94+
{
95+
"Name": "Amazon.Lambda.S3Events",
96+
"Path": "Libraries/src/Amazon.Lambda.S3Events/Amazon.Lambda.S3Events.csproj"
97+
},
98+
{
99+
"Name": "Amazon.Lambda.Serialization.Json",
100+
"Path": "Libraries/src/Amazon.Lambda.Serialization.Json/Amazon.Lambda.Serialization.Json.csproj"
101+
},
102+
{
103+
"Name": "Amazon.Lambda.Serialization.SystemTextJson",
104+
"Path": "Libraries/src/Amazon.Lambda.Serialization.SystemTextJson/Amazon.Lambda.Serialization.SystemTextJson.csproj"
105+
},
106+
{
107+
"Name": "Amazon.Lambda.SimpleEmailEvents",
108+
"Path": "Libraries/src/Amazon.Lambda.SimpleEmailEvents/Amazon.Lambda.SimpleEmailEvents.csproj"
109+
},
110+
{
111+
"Name": "Amazon.Lambda.SNSEvents",
112+
"Path": "Libraries/src/Amazon.Lambda.SNSEvents/Amazon.Lambda.SNSEvents.csproj"
113+
},
114+
{
115+
"Name": "Amazon.Lambda.SQSEvents",
116+
"Path": "Libraries/src/Amazon.Lambda.SQSEvents/Amazon.Lambda.SQSEvents.csproj"
117+
},
118+
{
119+
"Name": "Amazon.Lambda.TestUtilities",
120+
"Path": "Libraries/src/Amazon.Lambda.TestUtilities/Amazon.Lambda.TestUtilities.csproj"
121+
},
122+
{
123+
"Name": "Amazon.Lambda.TestTool.BlazorTester",
124+
"Paths": [
125+
"Tools/LambdaTestTool/src/Amazon.Lambda.TestTool.BlazorTester/Amazon.Lambda.TestTool.BlazorTester.csproj",
126+
"Tools/LambdaTestTool/src/Amazon.Lambda.TestTool.BlazorTester/Amazon.Lambda.TestTool.BlazorTester60-pack.csproj",
127+
"Tools/LambdaTestTool/src/Amazon.Lambda.TestTool.BlazorTester/Amazon.Lambda.TestTool.BlazorTester70-pack.csproj",
128+
"Tools/LambdaTestTool/src/Amazon.Lambda.TestTool.BlazorTester/Amazon.Lambda.TestTool.BlazorTester80-pack.csproj"
129+
]
130+
}
131+
],
132+
"UseCommitsForChangelog": false,
133+
"UseSameVersionForAllProjects": false,
134+
"DefaultIncrementType": "Patch",
135+
"ChangeFilesDetermineIncrementType": true
136+
}
+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# This GitHub Workflow will create a new release branch that contains the updated C# project versions and changelog.
2+
# The workflow will also create a PR that targets `dev` from the release branch.
3+
name: Create Release PR
4+
5+
# This workflow is manually triggered when in preparation for a release. The workflow should be dispatched from the `dev` branch.
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
OVERRIDE_VERSION:
10+
description: "Override Version"
11+
type: string
12+
required: false
13+
14+
permissions:
15+
id-token: write
16+
17+
jobs:
18+
release-pr:
19+
name: Release PR
20+
runs-on: ubuntu-latest
21+
22+
env:
23+
INPUT_OVERRIDE_VERSION: ${{ github.event.inputs.OVERRIDE_VERSION }}
24+
25+
steps:
26+
# Assume an AWS Role that provides access to the Access Token
27+
- name: Configure AWS Credentials
28+
uses: aws-actions/configure-aws-credentials@8c3f20df09ac63af7b3ae3d7c91f105f857d8497 #v4
29+
with:
30+
role-to-assume: ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_ROLE_ARN }}
31+
aws-region: us-west-2
32+
# Retrieve the Access Token from Secrets Manager
33+
- name: Retrieve secret from AWS Secrets Manager
34+
uses: aws-actions/aws-secretsmanager-get-secrets@v2
35+
with:
36+
secret-ids: |
37+
AWS_SECRET, ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_NAME }}
38+
parse-json-secrets: true
39+
# Checkout a full clone of the repo
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: '0'
44+
token: ${{ env.AWS_SECRET_TOKEN }}
45+
# Install .NET8 which is needed for AutoVer
46+
- name: Setup .NET 8.0
47+
uses: actions/setup-dotnet@v4
48+
with:
49+
dotnet-version: 8.0.x
50+
# Install AutoVer to automate versioning and changelog creation
51+
- name: Install AutoVer
52+
run: dotnet tool install --global AutoVer --version 0.0.24
53+
# Set up a git user to be able to run git commands later on
54+
- name: Setup Git User
55+
run: |
56+
git config --global user.email "[email protected]"
57+
git config --global user.name "aws-sdk-dotnet-automation"
58+
# Create the release branch which will contain the version changes and updated changelog
59+
- name: Create Release Branch
60+
id: create-release-branch
61+
run: |
62+
branch=releases/next-release
63+
git checkout -b $branch
64+
echo "BRANCH=$branch" >> $GITHUB_OUTPUT
65+
# Update the version of projects based on the change files
66+
- name: Increment Version
67+
run: autover version
68+
if: env.INPUT_OVERRIDE_VERSION == ''
69+
# Update the version of projects based on the override version
70+
- name: Increment Version
71+
run: autover version --use-version "$INPUT_OVERRIDE_VERSION"
72+
if: env.INPUT_OVERRIDE_VERSION != ''
73+
# Build the solution for the Source Generator to update the CloudFormation templates
74+
- name: Commit Template Changes
75+
run: |
76+
dotnet build Libraries/Libraries.sln -c Release
77+
git add "*.template"
78+
git commit -m "Update test app CloudFormation templates"
79+
# Update the changelog based on the change files
80+
- name: Update Changelog
81+
run: autover changelog
82+
# Push the release branch up as well as the created tag
83+
- name: Push Changes
84+
run: |
85+
branch=${{ steps.create-release-branch.outputs.BRANCH }}
86+
git push origin $branch
87+
git push origin $branch --tags
88+
# Get the release name that will be used to create a PR
89+
- name: Read Release Name
90+
id: read-release-name
91+
run: |
92+
version=$(autover changelog --release-name)
93+
echo "VERSION=$version" >> $GITHUB_OUTPUT
94+
# Get the changelog that will be used to create a PR
95+
- name: Read Changelog
96+
id: read-changelog
97+
run: |
98+
changelog=$(autover changelog --output-to-console)
99+
echo "CHANGELOG<<EOF"$'\n'"$changelog"$'\n'EOF >> "$GITHUB_OUTPUT"
100+
# Create the Release PR and label it
101+
- name: Create Pull Request
102+
env:
103+
GITHUB_TOKEN: ${{ env.AWS_SECRET_TOKEN }}
104+
run: |
105+
pr_url="$(gh pr create --title "${{ steps.read-release-name.outputs.VERSION }}" --body "${{ steps.read-changelog.outputs.CHANGELOG }}" --base dev --head ${{ steps.create-release-branch.outputs.BRANCH }})"
106+
gh label create "Release PR" --description "A Release PR that includes versioning and changelog changes" -c "#FF0000" -f
107+
gh pr edit $pr_url --add-label "Release PR"

0 commit comments

Comments
 (0)