Skip to content

Commit 77015bd

Browse files
committed
feat(core): add initial example
1 parent c284b66 commit 77015bd

File tree

10 files changed

+15987
-5
lines changed

10 files changed

+15987
-5
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
release:
8+
name: Release
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write
12+
contents: write
13+
issues: write
14+
pull-requests: write
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: lts/*
24+
- name: Install dependencies
25+
run: npm ci
26+
- name: Configure AWS Credentials
27+
uses: aws-actions/configure-aws-credentials@v1
28+
with:
29+
role-to-assume: ${{ secrets.CODE_ARTIFACT_PUBLISH_ROLE_ARN }}
30+
aws-region: us-east-1
31+
- name: Release
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
run: npx semantic-release

.gitignore

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# Snowpack dependency directory (https://snowpack.dev/)
45+
web_modules/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
# *.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
.parcel-cache
78+
79+
# Next.js build output
80+
.next
81+
out
82+
83+
# Nuxt.js build / generate output
84+
.nuxt
85+
dist
86+
87+
# Gatsby files
88+
.cache/
89+
# Comment in the public line in if your project uses Gatsby and not Next.js
90+
# https://nextjs.org/blog/next-9-1#public-directory-support
91+
# public
92+
93+
# vuepress build output
94+
.vuepress/dist
95+
96+
# Serverless directories
97+
.serverless/
98+
99+
# FuseBox cache
100+
.fusebox/
101+
102+
# DynamoDB Local files
103+
.dynamodb/
104+
105+
# TernJS port file
106+
.tern-port
107+
108+
# Stores VSCode versions used for testing VSCode extensions
109+
.vscode-test
110+
111+
# yarn v2
112+
.yarn/cache
113+
.yarn/unplugged
114+
.yarn/build-state.yml
115+
.yarn/install-state.gz
116+
.pnp.*

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/prepare-commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
exec < /dev/tty && node_modules/.bin/cz --hook || true

.releaserc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
["semantic-release-codeartifact", {
7+
"tool": "npm",
8+
"domain": "my-domain",
9+
"repository": "my-repo"
10+
}],
11+
"@semantic-release/npm",
12+
"@semantic-release/github"
13+
]
14+
}

README.md

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,57 @@
1-
## My Project
1+
# AWS CodeArtifact Semantic Release Example
22

3-
TODO: Fill this README out!
3+
## Summary
44

5-
Be sure to:
5+
This pattern shows how to integrate [semantic-release][semantic-release] into
6+
your project to automate the entire package release workflow of determining the
7+
next version number, generating release notes, and publishing the package to
8+
[AWS CodeArtifact][codeartifact].
69

7-
* Change the title in this README
8-
* Edit your repository description on GitHub
10+
In this example, we will be using GitHub with semantic-release to automate the
11+
release workflow of an npm package.
12+
13+
## Prerequisites and Limitations
14+
15+
### Prerequisites
16+
17+
- An active [AWS account][create-aws-account].
18+
- An [AWS CodeArtifact][codeartifact] repository.
19+
- A [GitHub][github] repository.
20+
- [Node.js][nodejs] v14.x or later on developer machines.
21+
22+
### Limitations
23+
24+
- The [semantic-release-coderatifact][semantic-release-codeartifact] plugin
25+
currently only supports npm at the time of writing.
26+
27+
## Architecture
28+
29+
![Architecture Image][architecture-img]
30+
31+
The diagram shows the following workflow:
32+
33+
1. Developers commit changes to the GitHub repository following a standardized
34+
commit message format (enforced by [commitizen][commitizen]).
35+
36+
1. The GitHub Action [release workflow][release-workflow] assumes the IAM role
37+
for publishing to CodeArtifact.
38+
39+
1. The npm package is published to the CodeArtifact repository.
40+
41+
## Tools
42+
43+
- [AWS CodeArtifact][codeartifact] - Fully managed artifact repository service.
44+
- [GitHub Actions][github-actions] - Runs release workflow.
45+
- [semantic-release][semantic-release] - Used to automate the package release workflow.
46+
- [semantic-release-codeartifact][semantic-release-codeartifact] - Plugin for AWS CodeArtifact.
47+
- [commitizen][commitizen] - Command line utility to help standardize commit messages.
48+
- [husky][husky] - Adds git hooks we use for automatically running commitizen on commit.
49+
50+
## Best Practices
51+
52+
## Related Resources
53+
54+
- [Semantic Release: How does it work?][semantic-release-how-does-it-work]
955

1056
## Security
1157

@@ -15,3 +61,16 @@ See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more inform
1561

1662
This library is licensed under the MIT-0 License. See the LICENSE file.
1763

64+
[architecture-img]:./docs/img/architecture.svg
65+
[codeartifact]:https://aws.amazon.com/codeartifact
66+
[commitizen]:https://github.com/commitizen/cz-cli
67+
[create-aws-account]:https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/
68+
[github-actions]:https://docs.github.com/en/actions
69+
[github]:https://github.com
70+
[husky]:https://www.npmjs.com/package/husky
71+
[nodejs]:https://nodejs.org/en/download/
72+
[release-workflow]:./.github/workflows/release.yml
73+
[semantic-release-codeartifact]:https://www.npmjs.com/package/semantic-release-codeartifact
74+
[semantic-release]:https://github.com/semantic-release/semantic-release
75+
[semver]:https://semver.org/
76+
[semantic-release-how-does-it-work]:https://github.com/semantic-release/semantic-release#how-does-it-work

docs/img/architecture.svg

Lines changed: 3 additions & 0 deletions
Loading

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports.hello = (name) => console.info(`hello ${name}`);
2+
3+
module.exports.cya = (name) => console.log(`cya ${name}`);

0 commit comments

Comments
 (0)