-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: release automation #8
Merged
Merged
Changes from 27 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
8c9b891
feat: use relative stack location
jta fa55932
fix: ignore the W3002 lint rule
obs-gh-colinhutchinson 41bd272
chore: ran the Makefile through a linter
obs-gh-colinhutchinson 18e1979
feat: ability to release to multiple regions
obs-gh-colinhutchinson f94a8fe
wip
obs-gh-colinhutchinson cb9d4c9
Merge branch 'main' into feat/release
obs-gh-colinhutchinson d417641
Merge pull request #1 from observeinc/feat/release
obs-gh-colinhutchinson c7954de
feat: setup automation for github releases
obs-gh-colinhutchinson 4125646
feat: empty commit to force a release
obs-gh-colinhutchinson 6d2e80d
fix: fix the release logic so commits to main are pre-release
obs-gh-colinhutchinson 50f3921
fix: run the release workflow on tags as well
obs-gh-colinhutchinson 50f8dc1
feat: allow for workflow dispatch to enable proper releases
obs-gh-colinhutchinson 830561b
fix: try debuggin why the config option doesn't work
obs-gh-colinhutchinson 6ade509
fix: debug if the issue is the .releaserc
obs-gh-colinhutchinson 266037f
fix: provide absolute path to the releaserc
obs-gh-colinhutchinson 0244d08
fix: continue debugging
obs-gh-colinhutchinson 0b701d5
feat: needs the file extension to keep node happy
obs-gh-colinhutchinson 50acc1f
feat: empty commit to force a release
obs-gh-colinhutchinson b2d9015
feat: empty commit to force a release
obs-gh-colinhutchinson 8c31500
feat: terraform to setup the aws / github federation
obs-gh-colinhutchinson 4e7f2a1
chore: check the terraform worked
obs-gh-colinhutchinson af0dbee
feat: connect github releases with AWS SAM releases
obs-gh-colinhutchinson 0f40bb7
feat: connect github releases with AWS SAM releases
obs-gh-colinhutchinson 8559453
chore: revert to see if we can release now
obs-gh-colinhutchinson 4fdc0d0
feat: connect aws sam releases w\ github releases
obs-gh-colinhutchinson 8aab86d
feat: when releasing do a build before doing the github release in ca…
obs-gh-colinhutchinson 99d026f
feat: make all SAM commands region sensitive
obs-gh-colinhutchinson c5f5af2
docs: ammend the release workflow to the README.md
obs-gh-colinhutchinson 2d8a12c
chore(release): add get-caller-identity to the release workflow
obs-gh-colinhutchinson 88dcbad
fix: set the release version for prerelease and full releases
obs-gh-colinhutchinson a14eb81
fix: releases need to include the packaged.yaml cloudformation file
obs-gh-colinhutchinson 132d50b
chore: introduce dependabot
obs-gh-colinhutchinson 87838a1
Merge pull request #3 from observeinc/chore/dependabot
obs-gh-colinhutchinson 6c80275
fix: syntax error with sending arguments to the forwarder aws sam sta…
obs-gh-colinhutchinson 5017eea
chore(deps): bump github.com/google/go-cmp from 0.5.8 to 0.6.0 (#10)
dependabot[bot] 89abce7
chore(deps): bump github.com/aws/aws-sdk-go-v2 from 1.21.0 to 1.21.1 …
dependabot[bot] 2c46a3b
chore(deps): bump actions/setup-go from 2 to 4 (#5)
dependabot[bot] e19573f
chore(deps): bump actions/checkout from 2 to 4 (#4)
dependabot[bot] d59abd0
chore(deps): bump github.com/aws/aws-sdk-go-v2/config (#7)
dependabot[bot] a7034dc
chore(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 (#6)
dependabot[bot] db6b339
fix: don't run releases on dependabot commits
obs-gh-colinhutchinson 4dd04cb
feat: force a release
obs-gh-colinhutchinson a7dc8af
feat: add beta/latest convenience releases
obs-gh-colinhutchinson 56bcd91
fix: stable pointer only for workflow dispatch
obs-gh-colinhutchinson 8528446
remove references to colin
obs-gh-colinhutchinson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: build | ||
run: make sam-build-all | ||
|
||
- name: Setup AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
aws-region: us-west-2 | ||
|
||
- name: github pre-release | ||
id: prerelease | ||
if: github.event_name == 'push' | ||
uses: ahmadnassri/action-semantic-release@v2 | ||
with: | ||
config: ${{ github.workspace }}/.releaserc.json | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: github full release | ||
id: fullrelease | ||
if: github.event_name == 'workflow_dispatch' | ||
uses: ahmadnassri/action-semantic-release@v2 | ||
with: | ||
config: ${{ github.workspace }}/.releaserc-release.json | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: aws sam release | ||
run: make sam-package-all-regions | ||
env: | ||
VERSION: ${{ steps.prerelease.outputs.release-version }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
name: Run Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,11 @@ | |
.aws-sam/ | ||
.*.swp | ||
build/ | ||
|
||
.terraform | ||
terraform.tfstate | ||
*.tfstate* | ||
terraform.tfvars | ||
tfplan | ||
|
||
.terraform.lock.hcl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"branches": ["main"], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
"@semantic-release/github" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"branches": [ | ||
{ | ||
"name": "release", | ||
"channel": false, | ||
"prerelease": false, | ||
"type": "maintenance" | ||
}, | ||
{ | ||
"name": "main", | ||
"channel": "beta", | ||
"prerelease": "beta" | ||
} | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
"@semantic-release/github" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
terraform { | ||
backend "s3" { | ||
bucket = "observeinc-terraform-state" | ||
region = "us-west-2" | ||
key = "github.com/observeinc/colin-aws-sam-testing" | ||
obs-gh-colinhutchinson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
locals { | ||
organization = "observeinc" | ||
repository = "colin-aws-sam-testing" | ||
obs-gh-colinhutchinson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
data "aws_iam_openid_connect_provider" "github_actions" { | ||
url = "https://token.actions.githubusercontent.com" | ||
} | ||
|
||
locals { | ||
oidc_claim_prefix = trimprefix(data.aws_iam_openid_connect_provider.github_actions.url, "https://") | ||
} | ||
|
||
data "aws_iam_policy_document" "github_actions_assume_role" { | ||
statement { | ||
actions = ["sts:AssumeRoleWithWebIdentity"] | ||
|
||
principals { | ||
type = "Federated" | ||
identifiers = [data.aws_iam_openid_connect_provider.github_actions.arn] | ||
} | ||
|
||
condition { | ||
test = "StringLike" | ||
variable = "${local.oidc_claim_prefix}:sub" | ||
values = ["repo:${local.organization}/${local.repository}:*"] | ||
} | ||
|
||
condition { | ||
test = "StringEquals" | ||
variable = "${local.oidc_claim_prefix}:aud" | ||
values = ["sts.amazonaws.com"] | ||
} | ||
} | ||
} | ||
|
||
resource "aws_iam_role" "github_actions_ci" { | ||
name = "${local.repository}-gha-ci" | ||
|
||
assume_role_policy = data.aws_iam_policy_document.github_actions_assume_role.json | ||
|
||
tags = { | ||
Principal = "GitHub Actions" | ||
Repository = "${local.organization}/${local.repository}" | ||
} | ||
} | ||
|
||
resource "aws_iam_role_policy_attachment" "admin_policy_attachment" { | ||
role = aws_iam_role.github_actions_ci.name | ||
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess" | ||
} | ||
|
||
resource "github_actions_secret" "aws_ci_role" { | ||
repository = local.repository | ||
secret_name = "AWS_ROLE_ARN" | ||
plaintext_value = aws_iam_role.github_actions_ci.arn | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
provider "github" { | ||
owner = local.organization | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
terraform { | ||
required_version = ">= 1.1.0" | ||
|
||
required_providers { | ||
github = { | ||
source = "integrations/github" | ||
version = "~> 5" | ||
} | ||
|
||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5" | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for future historians: this is a hack to trick semantic-release that we want
main
to do prereleases