Skip to content

Commit

Permalink
Merge pull request #243 from aws/master
Browse files Browse the repository at this point in the history
Merge `master` into `dev`
  • Loading branch information
philasmar authored Oct 22, 2024
2 parents 300825b + 4183a8c commit 463bb72
Show file tree
Hide file tree
Showing 9 changed files with 369 additions and 6 deletions.
11 changes: 11 additions & 0 deletions .autover/autover.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Projects": [
{
"Name": "Amazon.AspNetCore.Identity.Cognito",
"Path": "src/Amazon.AspNetCore.Identity.Cognito/Amazon.AspNetCore.Identity.Cognito.csproj"
}
],
"UseCommitsForChangelog": false,
"DefaultIncrementType": "Patch",
"ChangeFilesDetermineIncrementType": true
}
46 changes: 46 additions & 0 deletions .github/workflows/aws-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: AWS CI

on:
workflow_dispatch:
pull_request:
branches:
- master
- dev
- 'feature/**'

permissions:
id-token: write

jobs:
run-ci:
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 #v4
with:
role-to-assume: ${{ secrets.CI_MAIN_TESTING_ACCOUNT_ROLE_ARN }}
role-duration-seconds: 7200
aws-region: us-west-2
- name: Invoke Load Balancer Lambda
id: lambda
shell: pwsh
run: |
aws lambda invoke response.json --function-name "${{ secrets.CI_TESTING_LOAD_BALANCER_LAMBDA_NAME }}" --cli-binary-format raw-in-base64-out --payload '{"Roles": "${{ secrets.CI_TEST_RUNNER_ACCOUNT_ROLES }}", "ProjectName": "${{ secrets.CI_TESTING_CODE_BUILD_PROJECT_NAME }}", "Branch": "${{ github.sha }}"}'
$roleArn=$(cat ./response.json)
"roleArn=$($roleArn -replace '"', '')" >> $env:GITHUB_OUTPUT
- name: Configure Test Runner Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 #v4
with:
role-to-assume: ${{ steps.lambda.outputs.roleArn }}
role-duration-seconds: 7200
aws-region: us-west-2
- name: Run Tests on AWS
id: codebuild
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: ${{ secrets.CI_TESTING_CODE_BUILD_PROJECT_NAME }}
- name: CodeBuild Link
shell: pwsh
run: |
$buildId = "${{ steps.codebuild.outputs.aws-build-id }}"
echo $buildId
101 changes: 101 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This GitHub Workflow will create a new release branch that contains the updated C# project versions and changelog.
# The workflow will also create a PR that targets `dev` from the release branch.
name: Create Release PR

# This workflow is manually triggered when in preparation for a release. The workflow should be dispatched from the `dev` branch.
on:
workflow_dispatch:
inputs:
OVERRIDE_VERSION:
description: "Override Version"
type: string
required: false

permissions:
id-token: write

jobs:
release-pr:
name: Release PR
runs-on: ubuntu-latest

env:
INPUT_OVERRIDE_VERSION: ${{ github.event.inputs.OVERRIDE_VERSION }}

steps:
# Assume an AWS Role that provides access to the Access Token
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@8c3f20df09ac63af7b3ae3d7c91f105f857d8497 #v4
with:
role-to-assume: ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_ROLE_ARN }}
aws-region: us-west-2
# Retrieve the Access Token from Secrets Manager
- name: Retrieve secret from AWS Secrets Manager
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
AWS_SECRET, ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_NAME }}
parse-json-secrets: true
# Checkout a full clone of the repo
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
token: ${{ env.AWS_SECRET_TOKEN }}
# Install .NET8 which is needed for AutoVer
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
# Install AutoVer to automate versioning and changelog creation
- name: Install AutoVer
run: dotnet tool install --global AutoVer --version 0.0.21
# Set up a git user to be able to run git commands later on
- name: Setup Git User
run: |
git config --global user.email "[email protected]"
git config --global user.name "aws-sdk-dotnet-automation"
# Create the release branch which will contain the version changes and updated changelog
- name: Create Release Branch
id: create-release-branch
run: |
branch=releases/next-release
git checkout -b $branch
echo "BRANCH=$branch" >> $GITHUB_OUTPUT
# Update the version of projects based on the change files
- name: Increment Version
run: autover version
if: env.INPUT_OVERRIDE_VERSION == ''
# Update the version of projects based on the override version
- name: Increment Version
run: autover version --use-version "$INPUT_OVERRIDE_VERSION"
if: env.INPUT_OVERRIDE_VERSION != ''
# Update the changelog based on the change files
- name: Update Changelog
run: autover changelog
# Push the release branch up as well as the created tag
- name: Push Changes
run: |
branch=${{ steps.create-release-branch.outputs.BRANCH }}
git push origin $branch
git push origin $branch --tags
# Get the release name that will be used to create a PR
- name: Read Release Name
id: read-release-name
run: |
version=$(autover changelog --release-name)
echo "VERSION=$version" >> $GITHUB_OUTPUT
# Get the changelog that will be used to create a PR
- name: Read Changelog
id: read-changelog
run: |
changelog=$(autover changelog --output-to-console)
echo "CHANGELOG<<EOF"$'\n'"$changelog"$'\n'EOF >> "$GITHUB_OUTPUT"
# Create the Release PR and label it
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ env.AWS_SECRET_TOKEN }}
run: |
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 }})"
gh label create "Release PR" --description "A Release PR that includes versioning and changelog changes" -c "#FF0000" -f
gh pr edit $pr_url --add-label "Release PR"
137 changes: 137 additions & 0 deletions .github/workflows/sync-main-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# This GitHub Workflow is designed to run automatically after the Release PR, which was created by the `Create Release PR` workflow, is closed.
# This workflow has 2 jobs. One will run if the `Release PR` is successfully merged, indicating that a release should go out.
# The other will run if the `Release PR` was closed and a release is not intended to go out.
name: Sync 'dev' and 'master'

# The workflow will automatically be triggered when any PR is closed.
on:
pull_request:
types: [closed]

permissions:
contents: write
id-token: write

jobs:
# This job will check if the PR was successfully merged, it's source branch is `releases/next-release` and target branch is `dev`.
# This indicates that the merged PR was the `Release PR`.
# This job will synchronize `dev` and `master`, create a GitHub Release and delete the `releases/next-release` branch.
sync-dev-and-main:
name: Sync dev and master
if: |
github.event.pull_request.merged == true &&
github.event.pull_request.head.ref == 'releases/next-release' &&
github.event.pull_request.base.ref == 'dev'
runs-on: ubuntu-latest
steps:
# Assume an AWS Role that provides access to the Access Token
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@8c3f20df09ac63af7b3ae3d7c91f105f857d8497 #v4
with:
role-to-assume: ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_ROLE_ARN }}
aws-region: us-west-2
# Retrieve the Access Token from Secrets Manager
- name: Retrieve secret from AWS Secrets Manager
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
AWS_SECRET, ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_NAME }}
parse-json-secrets: true
# Checkout a full clone of the repo
- name: Checkout code
uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0
token: ${{ env.AWS_SECRET_TOKEN }}
# Install .NET8 which is needed for AutoVer
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
# Install AutoVer which is needed to retrieve information about the current release.
- name: Install AutoVer
run: dotnet tool install --global AutoVer --version 0.0.21
# Set up a git user to be able to run git commands later on
- name: Setup Git User
run: |
git config --global user.email "[email protected]"
git config --global user.name "aws-sdk-dotnet-automation"
# Retrieve the release name which is needed for the GitHub Release
- name: Read Release Name
id: read-release-name
run: |
version=$(autover changelog --release-name)
echo "VERSION=$version" >> $GITHUB_OUTPUT
# Retrieve the tag name which is needed for the GitHub Release
- name: Read Tag Name
id: read-tag-name
run: |
tag=$(autover changelog --tag-name)
echo "TAG=$tag" >> $GITHUB_OUTPUT
# Retrieve the changelog which is needed for the GitHub Release
- name: Read Changelog
id: read-changelog
run: |
changelog=$(autover changelog --output-to-console)
echo "CHANGELOG<<EOF"$'\n'"$changelog"$'\n'EOF >> "$GITHUB_OUTPUT"
# Merge dev into master in order to synchronize the 2 branches
- name: Merge dev to master
run: |
git fetch origin
git checkout master
git merge dev
git push origin master
# Create the GitHub Release
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ env.AWS_SECRET_TOKEN }}
run: |
gh release create "${{ steps.read-tag-name.outputs.TAG }}" --title "${{ steps.read-release-name.outputs.VERSION }}" --notes "${{ steps.read-changelog.outputs.CHANGELOG }}"
# Delete the `releases/next-release` branch
- name: Clean up
run: |
git fetch origin
git push origin --delete releases/next-release
# This job will check if the PR was closed, it's source branch is `releases/next-release` and target branch is `dev`.
# This indicates that the closed PR was the `Release PR`.
# This job will delete the tag created by AutoVer and the release branch.
clean-up-closed-release:
name: Clean up closed release
if: |
github.event.pull_request.merged == false &&
github.event.pull_request.head.ref == 'releases/next-release' &&
github.event.pull_request.base.ref == 'dev'
runs-on: ubuntu-latest
steps:
# Checkout a full clone of the repo
- name: Checkout code
uses: actions/checkout@v4
with:
ref: releases/next-release
fetch-depth: 0
# Install .NET8 which is needed for AutoVer
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
# Install AutoVer which is needed to retrieve information about the current release.
- name: Install AutoVer
run: dotnet tool install --global AutoVer --version 0.0.21
# Set up a git user to be able to run git commands later on
- name: Setup Git User
run: |
git config --global user.email "[email protected]"
git config --global user.name "aws-sdk-dotnet-automation"
# Retrieve the tag name to be deleted
- name: Read Tag Name
id: read-tag-name
run: |
tag=$(autover changelog --tag-name)
echo "TAG=$tag" >> $GITHUB_OUTPUT
# Delete the tag created by AutoVer and the release branch
- name: Clean up
run: |
git fetch origin
git push --delete origin ${{ steps.read-tag-name.outputs.TAG }}
git push origin --delete releases/next-release
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
**/project.lock.json
**/*.nuspec

packages
packages

# JetBrains Rider
.idea/
*.sln.iml
15 changes: 10 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
### 3.0.2 (2024-04-20)
## Release 2024-04-20

### Amazon.AspNetCore.Identity.Cognito (3.0.2)
* Update User-Agent string

### 3.0.1 (2021-07-06)
## Release 2021-07-06

### Amazon.AspNetCore.Identity.Cognito (3.0.1)
* Pull request [#223](https://github.com/aws/aws-aspnet-cognito-identity-provider/pull/223) Fix UTC time conversion. Thanks [Joseph Fergusson](https://github.com/PhonicCanine)

### 3.0.0 (2021-07-06)
* Add target framework .NET Core 3.1
* Remove target framework .NET Core 3.0
## Release 2021-07-06

### Amazon.AspNetCore.Identity.Cognito (3.0.0)
* Add target framework .NET Core 3.1
* Remove target framework .NET Core 3.0
43 changes: 43 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,49 @@ To send us a pull request, please:
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).

## Adding a `change file` to your contribution branch

Each contribution branch should include a `change file` that contains a changelog message for each project that has been updated, as well as the type of increment to perform for those changes when versioning the project.

A `change file` looks like the following example:
```json
{
"Projects": [
{
"Name": "Amazon.AspNetCore.Identity.Cognito",
"Type": "Patch",
"ChangelogMessages": [
"Fixed an issue causing a failure somewhere"
]
}
]
}
```
The `change file` lists all the modified projects, the changelog message for each project as well as the increment type.

These files are located in the repo at .autover/changes/

You can use the `AutoVer` tool to create the change file. You can install it using the following command:
```
dotnet tool install -g AutoVer
```

You can create the `change file` using the following command:
```
autover change --project-name "Amazon.AspNetCore.Identity.Cognito" -m "Fixed an issue causing a failure somewhere
```
Note: Make sure to run the command from the root of the repository.

You can update the command to specify which project you are updating.
The available projects are:
* Amazon.AspNetCore.Identity.Cognito

The possible increment types are:
* Patch
* Minor
* Major

Note: You do not need to create a new `change file` for every changelog message or project within your branch. You can create one `change file` that contains all the modified projects and the changelog messages.

## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/aws/aws-aspnet-cognito-identity-provider/labels/help%20wanted) issues is a great place to start.
Expand Down
Loading

0 comments on commit 463bb72

Please sign in to comment.