Skip to content

Commit 4989c88

Browse files
committed
feat: setup canary releases using changesets
1 parent f597c69 commit 4989c88

File tree

6 files changed

+4174
-218
lines changed

6 files changed

+4174
-218
lines changed

.changeset/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"linked": [],
6+
"access": "public",
7+
"baseBranch": "main",
8+
"updateInternalDependencies": "patch",
9+
"ignore": []
10+
}

.github/workflows/canary.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Canary Release
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
env:
9+
NODE_VERSION_USED_FOR_DEVELOPMENT: 17
10+
jobs:
11+
publish-canary:
12+
name: Publish Canary
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Main
16+
uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
persist-credentials: false
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v2
23+
with:
24+
cache: npm
25+
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
26+
27+
- name: Install Dependencies
28+
run: npm ci --ignore-scripts
29+
30+
- name: Setup NPM credentials
31+
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
34+
35+
- name: Release Canary
36+
id: canary
37+
uses: 'kamilkisiela/release-canary@master'
38+
with:
39+
npm-token: ${{ secrets.NODE_AUTH_TOKEN }}
40+
npm-script: 'npm run release:canary'
41+
changesets: true
42+
43+
- name: Publish a message
44+
if: steps.canary.outputs.released
45+
uses: 'kamilkisiela/pr-comment@master'
46+
with:
47+
message: |
48+
The latest changes of this PR are available as alpha in npm (based on the declared `changesets`):
49+
```
50+
${{ steps.canary.outputs.changesetsPublishedPackages}}
51+
```
52+
bot-token: ${{ secrets.GH_API_TOKEN }}
53+
bot: 'theguild-bot'
54+
github-token: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Publish a empty message
57+
if: steps.canary.outputs.released == 'false'
58+
uses: 'kamilkisiela/pr-comment@master'
59+
with:
60+
message: |
61+
The latest changes of this PR are not available as alpha, since there are no linked `changesets` for this PR.
62+
bot-token: ${{ secrets.GH_API_TOKEN }}
63+
bot: 'theguild-bot'
64+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)