Skip to content

Commit

Permalink
feat: migrate to semantic-releas
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUnderScorer committed Oct 23, 2023
1 parent e63ed0e commit a781f02
Show file tree
Hide file tree
Showing 80 changed files with 4,888 additions and 61,551 deletions.
131 changes: 131 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"branches": [
"main",
{
"name": "test",
"prerelease": true
}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{
"type": "build",
"scope": "deps",
"release": "patch"
},
{
"type": "docs",
"scope": "README",
"release": "patch"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalCommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "feature",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "docs",
"scope": "README",
"section": "Documentation"
},
{
"type": "build",
"scope": "deps",
"section": "Build System"
},
{
"type": "docs",
"section": "Documentation",
"hidden": true
},
{
"type": "style",
"section": "Styles",
"hidden": true
},
{
"type": "chore",
"section": "Miscellaneous Chores",
"hidden": true
},
{
"type": "refactor",
"section": "Code Refactoring",
"hidden": true
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System",
"hidden": true
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
[
"@semantic-release/exec",
{
"prepareCmd": "yarn build",
"publishCmd": "./scripts/preparePackage.sh"
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json"
]
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "package.zip"
}
]
}
]
]
}
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ For proposing changes, use the standard [pull request approach](https://docs.git
aws lambda update-function-code --function-name <LAMBDA_FUNCTION_NAME> --region <AWS_REGION> --zip-file file://lambda.zip --publish
```

You can invoke the function from your local environment using the [Invoke command](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/lambda/invoke.html) in the AWS CLI, for example `aws lambda invoke --function-name <LAMBDA_FUNCTION_NAME> --region <AWS_REGION> --invocation-type RequestResponse --payload <EVENT_JSON>`, where the `<EVENT_JSON>` is the JSON you want to provide to your Lambda function as input. See [examples of events here](test/lambda).
You can invoke the function from your local environment using the [Invoke command](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/lambda/invoke.html) in the AWS CLI, for example `aws lambda invoke --function-name <LAMBDA_FUNCTION_NAME> --region <AWS_REGION> --invocation-type RequestResponse --payload <EVENT_JSON>`, where the `<EVENT_JSON>` is the JSON you want to provide to your Lambda function as input. See [examples of events here](proxy/test/lambda).

To deploy your function to your CloudFront distribution follow the [Cloudfront Developer Guide](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-how-it-works-tutorial.html#lambda-edge-how-it-works-tutorial-add-trigger).

Expand Down Expand Up @@ -58,4 +58,4 @@ The workflow `release.yml` is responsible for releasing a new version. It has to

### How to keep your worker up-to-date

CloudFront Integration by Fingerprint always uses the latest stable version for the customers and upgrades customer Lambda@Edge automatically by running CodePipeline once a new version of Lambda@Edge function is available on the public [S3 bucket](s3://fingerprint-pro-cloudfront-integration-lambda-function/release/lambda_latest.zip). The serverless application that contains the CodePipeline is responsible for delivering new updates from the S3 bucket to the customer's infrastructure.
CloudFront Integration by Fingerprint always uses the latest stable version for the customers and upgrades customer Lambda@Edge automatically by running CodePipeline once a new version of Lambda@Edge function is available on the public [S3 bucket](s3://fingerprint-pro-cloudfront-integration-lambda-function/release/lambda_latest.zip). The serverless application that contains the CodePipeline is responsible for delivering new updates from the S3 bucket to the customer's infrastructure.
41 changes: 40 additions & 1 deletion buildspec.release-lambda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,43 @@ version: 0.2
phases:
build:
commands:
- echo $CODEBUILD_RESOLVED_SOURCE_VERSION
- node scripts/downloadGithubRelease.mjs
- unzip package.zip -d dist
- cd dist

- zip -r latest.zip fingerprintjs-pro-cloudfront-lambda-function.js
- zip -r latest_mgmt.zip fingerprintjs-pro-cloudfront-mgmt-lambda-function.js

- aws s3api get-object --bucket fingerprint-pro-cloudfront-integration-lambda-function --key release/lambda_latest.zip previous.zip
- aws s3api get-object --bucket fingerprint-pro-cloudfront-integration-lambda-function --key release/mgmt_lambda_latest.zip previous_mgmt.zip

- unzip previous.zip -d previous
- unzip previous_mgmt.zip -d previous_mgmt

- diff previous/fingerprintjs-pro-cloudfront-lambda-function.js fingerprintjs-pro-cloudfront-lambda-function.js; diffStatus=$?
- diff previous_mgmt/fingerprintjs-pro-cloudfront-mgmt-lambda-function.js fingerprintjs-pro-cloudfront-mgmt-lambda-function.js; mgmtDiffStatus=$?

- echo $diffStatus
- echo $mgmtDiffStatus

- >-
if [ $diffStatus -eq 0 ]; then
echo "Files are the same. Don't need to upload the file."
elif [ $diffStatus -eq 1 ]; then
echo "Files are different. Uploading new version."
#TODO uncomment
#aws s3api put-object --body latest.zip --bucket fingerprint-pro-cloudfront-integration-lambda-function --key release/lambda_latest.zip
else
echo "There was something wrong with the diff command."
fi
- >-
if [ $mgmtDiffStatus -eq 0 ]; then
echo "Files are the same. Don't need to upload the file."
elif [ $mgmtDiffStatus -eq 1 ]; then
echo "Files are different. Uploading new version."
#TODO uncomment
#aws s3api put-object --body latest_mgmt.zip --bucket fingerprint-pro-cloudfront-integration-lambda-function --key release/mgmt_lambda_latest.zip
else
echo "There was something wrong with the diff command."
fi
6 changes: 0 additions & 6 deletions buildspec.release-mgmt.yml

This file was deleted.

1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] }
10 changes: 0 additions & 10 deletions dist/fingerprintjs-pro-cloudfront-lambda-function.d.ts

This file was deleted.

Loading

0 comments on commit a781f02

Please sign in to comment.