Skip to content

Commit 484ec68

Browse files
GitHub Actions release workflow addition (#853)
1 parent 3136252 commit 484ec68

File tree

6 files changed

+1372
-13
lines changed

6 files changed

+1372
-13
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/react-native-app-auth"
7+
}
8+
],
9+
"access": "public",
10+
"baseBranch": "main"
11+
}

.changeset/swift-toys-speak.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-native-app-auth': patch
3+
---
4+
5+
Adding GitHub release workflow

.github/CONTRIBUTING.md

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ If you don't feel comfortable making changes to both, feel free to contribute
4242
## How do I contribute code?
4343

4444
1. Search for something you'd like to change. This can be an open issue, or just a feature
45-
you'd like to implement. Make sure that no one else is already on it, so that you're not
46-
duplicating someone else's effort.
45+
you'd like to implement. Make sure that no one else is already on it, so that you're not
46+
duplicating someone else's effort.
4747

4848
2. Fork the repository and then clone it, i.e. `git clone https://github.com/YOUR_NAME/react-native-app-auth.git`
4949

@@ -57,11 +57,54 @@ If you don't feel comfortable making changes to both, feel free to contribute
5757

5858
7. Commit your changes with a short description, `git add -A && git commit -m 'Your meaningful and descriptive message'`
5959

60-
6. Push your new branch, `git push -u origin fix/issue-123`
60+
8. Push your new branch, `git push -u origin fix/issue-123`
6161

62-
7. Finally, open a pull request with a title and a short summary of what has been changed and why.
62+
9. Finally, open a pull request with a title and a short summary of what has been changed and why.
6363

64-
8. Wait for a maintainer to review it and make some changes as they're being recommended and as you see fit.
64+
10. Wait for a maintainer to review it and make some changes as they're being recommended and as you see fit.
6565

66-
9. Get it merged and make cool a celebratory pose! :dancer:
66+
11. Get it merged and make cool a celebratory pose! :dancer:
6767

68+
### Using changesets
69+
70+
Our official release path is to use automation to perform the actual publishing of our packages. The steps are to:
71+
72+
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.
73+
2. On merge of a PR our automation system opens a "Version Packages" PR.
74+
3. On merging the "Version Packages" PR, the automation system publishes the packages.
75+
76+
Here are more details:
77+
78+
### Add a changeset
79+
80+
When you would like to add a changeset (which creates a file indicating the type of change), in your branch/PR issue this command:
81+
82+
```sh
83+
$ yarn changeset
84+
```
85+
86+
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:
87+
88+
1. Aim for a single line, 1+ sentences as appropriate.
89+
2. Include issue links in GH format (e.g. `#123`).
90+
3. You don't need to reference the current pull request or whatnot, as that will be added later automatically.
91+
92+
After this, you'll see a new uncommitted file in `.changesets` like:
93+
94+
```sh
95+
$ git status
96+
# ....
97+
Untracked files:
98+
(use "git add <file>..." to include in what will be committed)
99+
.changeset/flimsy-pandas-marry.md
100+
```
101+
102+
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!
103+
104+
### Creating versions
105+
106+
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.
107+
108+
### Publishing packages
109+
110+
On the merge of a version packages PR, the changesets GitHub action will publish the packages to npm.

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
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: Unit Tests
28+
run: yarn test
29+
30+
- name: PR or Publish
31+
id: changesets
32+
uses: changesets/action@v1
33+
with:
34+
version: yarn changeset version
35+
publish: yarn changeset publish
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
],
2727
"repository": {
2828
"type": "git",
29-
"url": "git+https://github.com/FormidableLabs/react-native-app-auth.git"
29+
"url": "https://github.com/FormidableLabs/react-native-app-auth"
3030
},
3131
"bugs": {
3232
"url": "https://github.com/FormidableLabs/react-native-app-auth/issues"
@@ -47,6 +47,7 @@
4747
"react-native": ">=0.63.0"
4848
},
4949
"devDependencies": {
50+
"@svitejs/changesets-changelog-github-compact": "^0.1.1",
5051
"babel-eslint": "10.0.3",
5152
"eslint": "6.8.0",
5253
"eslint-config-formidable": "4.0.0",
@@ -64,6 +65,7 @@
6465
"react-native": "0.61.5"
6566
},
6667
"dependencies": {
68+
"@changesets/cli": "^2.26.1",
6769
"invariant": "2.2.4",
6870
"react-native-base64": "0.0.2"
6971
},
@@ -74,5 +76,8 @@
7476
"hooks": {
7577
"pre-commit": "lint-staged"
7678
}
79+
},
80+
"publishConfig": {
81+
"provenance": true
7782
}
7883
}

0 commit comments

Comments
 (0)