diff --git a/.autover/autover.json b/.autover/autover.json new file mode 100644 index 000000000..c3825d691 --- /dev/null +++ b/.autover/autover.json @@ -0,0 +1,19 @@ +{ + "Projects": [ + { + "Name": "AWS.Deploy.CLI", + "Path": "src/AWS.Deploy.CLI/AWS.Deploy.CLI.csproj" + }, + { + "Name": "AWS.Deploy.Recipes.CDK.Common", + "Path": "src/AWS.Deploy.Recipes.CDK.Common/AWS.Deploy.Recipes.CDK.Common.csproj" + }, + { + "Name": "AWS.Deploy.ServerMode.Client", + "Path": "src/AWS.Deploy.ServerMode.Client/AWS.Deploy.ServerMode.Client.csproj" + } + ], + "UseCommitsForChangelog": false, + "DefaultIncrementType": "Patch", + "ChangeFilesDetermineIncrementType": true +} \ No newline at end of file diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md deleted file mode 100644 index 5f3b47dbf..000000000 --- a/.chglog/CHANGELOG.tpl.md +++ /dev/null @@ -1,22 +0,0 @@ -{{ range .Versions }} - -## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} - -{{ range .CommitGroups -}} -### {{ .Title }} - -{{ range .Commits -}} -* {{ .Subject | upperFirst }} -{{ end }} -{{ end -}} - -{{- if .NoteGroups -}} -{{ range .NoteGroups -}} -### {{ .Title }} - -{{ range .Notes }} -{{ .Body }} -{{ end }} -{{ end -}} -{{ end -}} -{{ end -}} diff --git a/.chglog/config.yml b/.chglog/config.yml deleted file mode 100644 index c40e8eb34..000000000 --- a/.chglog/config.yml +++ /dev/null @@ -1,52 +0,0 @@ -style: github -template: CHANGELOG.tpl.md -info: - title: CHANGELOG - repository_url: https://github.com/aws/aws-dotnet-deploy -options: - commits: - filters: - Type: - - feat - - fix - - docs - - style - - refactor - - perf - - test - - build - - ci - - chore - sort_by: Subject - commit_groups: - sort_by: Custom - title_order: - - feat - - fix - - docs - - style - - refactor - - perf - - test - - build - - ci - - chore - title_maps: - feat: Features - fix: Bug Fixes - docs: Documentation - style: Style - refactor: Code Refactoring - perf: Performance Improvements - test: Testing - build: Build System or External Dependencies - ci: CI Configuration Changes - chore: Chore - header: - pattern: "^(\\w*)\\:\\s(.*)$" - pattern_maps: - - Type - - Subject - notes: - keywords: - - BREAKING CHANGE diff --git a/.github/workflows/codebuild-ci.yml b/.github/workflows/aws-ci.yml similarity index 85% rename from .github/workflows/codebuild-ci.yml rename to .github/workflows/aws-ci.yml index 982aa285c..97e56624a 100644 --- a/.github/workflows/codebuild-ci.yml +++ b/.github/workflows/aws-ci.yml @@ -1,11 +1,8 @@ -name: AWS CodeBuild CI +name: AWS CI on: # Manually trigger on specific branches workflow_dispatch: - push: - branches: - - dev pull_request: branches: - main @@ -16,7 +13,7 @@ permissions: id-token: write jobs: - run-integration-tests: + run-ci: runs-on: ubuntu-latest steps: - name: Configure AWS Credentials @@ -25,12 +22,6 @@ jobs: role-to-assume: ${{ secrets.CI_MAIN_TESTING_ACCOUNT_ROLE_ARN }} role-duration-seconds: 7200 aws-region: us-west-2 - - - name: Setup .NET Core 6.0 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 6.0.x - - name: Invoke Load Balancer Lambda id: lambda shell: pwsh @@ -38,17 +29,15 @@ jobs: 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@8c3f20df09ac63af7b3ae3d7c91f105f857d8497 #v4 with: role-to-assume: ${{ steps.lambda.outputs.roleArn }} role-duration-seconds: 7200 aws-region: us-west-2 - - - name: Run CodeBuild + - name: Run Tests on AWS id: codebuild - uses: aws-actions/aws-codebuild-run-build@v1.0.3 + uses: aws-actions/aws-codebuild-run-build@v1 with: project-name: ${{ secrets.CI_TESTING_CODE_BUILD_PROJECT_NAME }} env-vars-for-codebuild: CODECOV_TOKEN diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml new file mode 100644 index 000000000..7f27a6503 --- /dev/null +++ b/.github/workflows/create-release-pr.yml @@ -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 "github-aws-sdk-dotnet-automation@amazon.com" + 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<> "$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" \ No newline at end of file diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml deleted file mode 100644 index 4834cc1a0..000000000 --- a/.github/workflows/prepare-release.yml +++ /dev/null @@ -1,79 +0,0 @@ -# This is a basic workflow that is manually triggered to prepare the release -# It creates two PRs -# 1. Pulls target branch to main -# 2. Increment minor version of target branch - -name: Prepare Release - -on: - workflow_dispatch: - -jobs: - pulling-into-main: - name: Pulling into main - runs-on: ubuntu-latest - - outputs: - # set PR_URL as output of job to add in body of version bump PR - PR_URL: ${{ steps.pull-request.outputs.pr_url }} - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Read Current Version - id: read-current-version - run: | - version=$(jq -r ".version" version.json) - echo "VERSION=$version" >> $GITHUB_OUTPUT - - - name: Pull Request - id: pull-request - uses: repo-sync/pull-request@v2 - with: - destination_branch: "main" - pr_title: 'chore: release ${{ steps.read-current-version.outputs.VERSION }}' - pr_body: "Pulling ${{ github.ref }} into main." - github_token: ${{ secrets.GITHUB_TOKEN }} - pr_label: "auto-pr" - - version-bump: - name: Version bump - runs-on: ubuntu-latest - needs: [pulling-into-main] - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Build Next Version - id: build-next-version - run: | - version=$(jq -r .version version.json) - major=$(echo $version | awk '{split($0, components, "."); print components[1]}') - minor=$(echo $version | awk '{split($0, components, "."); print components[2]+1}') - echo "VERSION=$major.$minor" >> $GITHUB_OUTPUT - - - name: Commit and Push next version - id: commit-push - run: | - git config --global user.email "github-aws-sdk-dotnet-automation@amazon.com" - git config --global user.name "aws-sdk-dotnet-automation" - content=$(jq '.version = "${{ steps.build-next-version.outputs.VERSION }}"' version.json) - echo $content | jq '.' > version.json - branch=build/version-bump-${{ steps.build-next-version.outputs.VERSION }} - git checkout -b $branch - git add version.json - git commit -m "build: version bump to ${{ steps.build-next-version.outputs.VERSION }}" - git push origin $branch - echo "BRANCH=$branch" >> $GITHUB_OUTPUT - - - name: pull-request - uses: repo-sync/pull-request@v2 - with: - source_branch: ${{ steps.commit-push.outputs.BRANCH }} - destination_branch: "dev" - pr_title: "build: version bump to ${{ steps.build-next-version.outputs.VERSION }}" - pr_body: "Merge after ${{ needs.pulling-into-main.outputs.PR_URL }} is merged." - github_token: ${{ secrets.GITHUB_TOKEN }} - pr_label: "auto-pr" diff --git a/.github/workflows/sync-main-dev.yml b/.github/workflows/sync-main-dev.yml new file mode 100644 index 000000000..63bf768bf --- /dev/null +++ b/.github/workflows/sync-main-dev.yml @@ -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 'main' + +# 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 `main`, create a GitHub Release and delete the `releases/next-release` branch. + sync-dev-and-main: + name: Sync dev and main + 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 "github-aws-sdk-dotnet-automation@amazon.com" + 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<> "$GITHUB_OUTPUT" + # Merge dev into main in order to synchronize the 2 branches + - name: Merge dev to main + run: | + git fetch origin + git checkout main + git merge dev + git push origin main + # 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 "github-aws-sdk-dotnet-automation@amazon.com" + 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 \ No newline at end of file diff --git a/src/AWS.Deploy.CLI/AWS.Deploy.CLI.csproj b/src/AWS.Deploy.CLI/AWS.Deploy.CLI.csproj index 6ea643005..1822d33f2 100644 --- a/src/AWS.Deploy.CLI/AWS.Deploy.CLI.csproj +++ b/src/AWS.Deploy.CLI/AWS.Deploy.CLI.csproj @@ -18,6 +18,7 @@ $(NoWarn);1570;1591;ASP0000 Major README.md + 1.25.3 diff --git a/src/AWS.Deploy.Recipes.CDK.Common/AWS.Deploy.Recipes.CDK.Common.csproj b/src/AWS.Deploy.Recipes.CDK.Common/AWS.Deploy.Recipes.CDK.Common.csproj index be4fa36df..2bf292ce1 100644 --- a/src/AWS.Deploy.Recipes.CDK.Common/AWS.Deploy.Recipes.CDK.Common.csproj +++ b/src/AWS.Deploy.Recipes.CDK.Common/AWS.Deploy.Recipes.CDK.Common.csproj @@ -10,6 +10,7 @@ icon.png https://github.com/aws/aws-dotnet-deploy README.md + 1.25.3 diff --git a/src/AWS.Deploy.ServerMode.Client/AWS.Deploy.ServerMode.Client.csproj b/src/AWS.Deploy.ServerMode.Client/AWS.Deploy.ServerMode.Client.csproj index d5c1c108c..fa030d882 100644 --- a/src/AWS.Deploy.ServerMode.Client/AWS.Deploy.ServerMode.Client.csproj +++ b/src/AWS.Deploy.ServerMode.Client/AWS.Deploy.ServerMode.Client.csproj @@ -12,12 +12,13 @@ https://github.com/aws/aws-dotnet-deploy true ..\..\public.snk + 1.25.3 - diff --git a/src/Directory.Build.props b/src/Directory.Build.props index a1329c82d..9d1a00ade 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,11 +1,5 @@ - - - 3.6.133 - all - - true 9 diff --git a/version.json b/version.json deleted file mode 100644 index f3be6c201..000000000 --- a/version.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.26", - "publicReleaseRefSpec": [ - ".*" - ], - "cloudBuild": { - "setAllVariables": false, - "buildNumber": { - "enabled": false - }, - "setVersionVariables": false - } -}