Skip to content

Commit 824d61d

Browse files
Merge pull request #355 from FormidableLabs/ci-provenance
GitHub Actions release workflow addition
2 parents 47e25db + 72f6eee commit 824d61d

File tree

6 files changed

+1158
-17
lines changed

6 files changed

+1158
-17
lines changed

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
3+
"changelog": [
4+
"@svitejs/changesets-changelog-github-compact",
5+
{
6+
"repo": "FormidableLabs/serverless-jetpack"
7+
}
8+
],
9+
"access": "public",
10+
"baseBranch": "master"
11+
}

.changeset/good-mice-float.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"serverless-jetpack": patch
3+
---
4+
5+
Adding GitHub release workflow

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
release:
8+
name: Release
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
id-token: write
13+
issues: write
14+
repository-projects: write
15+
deployments: write
16+
packages: write
17+
pull-requests: write
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
24+
- name: Install dependencies
25+
run: yarn install --frozen-lockfile
26+
27+
- name: Build
28+
run: yarn build
29+
30+
- name: Unit Tests
31+
run: yarn test
32+
33+
- name: PR or Publish
34+
id: changesets
35+
uses: changesets/action@v1
36+
with:
37+
version: yarn changeset version
38+
publish: yarn changeset publish
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

CONTRIBUTING.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,62 @@ $ vim README.md
153153
$ yarn run check
154154
```
155155

156-
## Releasing a new version to NPM
156+
### Using changesets
157157

158-
_Only for project administrators_.
158+
Our official release path is to use automation to perform the actual publishing of our packages. The steps are to:
159+
160+
1. A human developer adds a changeset. Ideally this is as a part of a PR that will have a version impact on a package.
161+
2. On merge of a PR our automation system opens a "Version Packages" PR.
162+
3. On merging the "Version Packages" PR, the automation system publishes the packages.
163+
164+
Here are more details:
165+
166+
### Add a changeset
167+
168+
When you would like to add a changeset (which creates a file indicating the type of change), in your branch/PR issue this command:
169+
170+
```sh
171+
$ yarn changeset
172+
```
173+
174+
to produce an interactive menu. Navigate the packages with arrow keys and hit `<space>` to select 1+ packages. Hit `<return>` when done. Select semver versions for packages and add appropriate messages. From there, you'll be prompted to enter a summary of the change. Some tips for this summary:
175+
176+
1. Aim for a single line, 1+ sentences as appropriate.
177+
2. Include issue links in GH format (e.g. `#123`).
178+
3. You don't need to reference the current pull request or whatnot, as that will be added later automatically.
179+
180+
After this, you'll see a new uncommitted file in `.changesets` like:
181+
182+
```sh
183+
$ git status
184+
# ....
185+
Untracked files:
186+
(use "git add <file>..." to include in what will be committed)
187+
.changeset/flimsy-pandas-marry.md
188+
```
189+
190+
Review the file, make any necessary adjustments, and commit it to source. When we eventually do a package release, the changeset notes and version will be incorporated!
191+
192+
### Creating versions
193+
194+
On a merge of a feature PR, the changesets GitHub action will open a new PR titled `"Version Packages"`. This PR is automatically kept up to date with additional PRs with changesets. So, if you're not ready to publish yet, just keep merging feature PRs and then merge the version packages PR later.
195+
196+
### Publishing packages
197+
198+
On the merge of a version packages PR, the changesets GitHub action will publish the packages to npm.
199+
200+
### Manually Releasing a new version to NPM
201+
202+
<details>
203+
<summary>
204+
<i>Only for project administrators</i>
205+
</summary>
159206

160207
1. Update `CHANGELOG.md`, following format for previous versions
161208
2. Commit as "Changes for version VERSION"
162209
3. Run `npm version patch` (or `minor|major|VERSION`) to run tests and lint,
163210
build published directories, then update `package.json` + add a git tag.
164211
4. Run `npm publish` and publish to NPM if all is well.
165212
5. Run `git push && git push --tags`
213+
214+
</details>

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
"trace-deps": "^0.4.0"
5050
},
5151
"devDependencies": {
52+
"@changesets/cli": "^2.26.1",
53+
"@svitejs/changesets-changelog-github-compact": "^0.1.1",
5254
"adm-zip": "^0.5.5",
5355
"babel-eslint": "^10.1.0",
5456
"chai": "^4.3.4",
@@ -72,5 +74,8 @@
7274
"sinon": "^11.1.1",
7375
"sinon-chai": "^3.7.0",
7476
"strip-ansi": "^6.0.0"
77+
},
78+
"publishConfig": {
79+
"provenance": true
7580
}
7681
}

0 commit comments

Comments
 (0)