Skip to content

Commit e7f19f2

Browse files
authored
feat: use new release flow (#2229)
1 parent 6892035 commit e7f19f2

File tree

8 files changed

+191
-389
lines changed

8 files changed

+191
-389
lines changed

.changeset/config.json

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3-
"changelog": "@changesets/cli/changelog",
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "urigo/graphql-modules" }
6+
],
47
"commit": false,
58
"linked": [],
6-
"access": "restricted",
9+
"access": "public",
710
"baseBranch": "master",
811
"updateInternalDependencies": "patch",
912
"ignore": [
@@ -12,5 +15,9 @@
1215
"examples-di",
1316
"examples-subscriptions",
1417
"graphql-yoga"
15-
]
18+
],
19+
"snapshot": {
20+
"useCalculatedVersion": true,
21+
"prereleaseTemplate": "{tag}-{datetime}-{commit}"
22+
}
1623
}

.github/workflows/canary.yml

+18-56
Original file line numberDiff line numberDiff line change
@@ -4,72 +4,34 @@ on:
44
pull_request:
55
branches:
66
- master
7+
paths:
8+
- ".changeset/**/*.md"
79

810
jobs:
9-
publish-canary:
10-
name: Publish Canary
11+
canary:
1112
runs-on: ubuntu-latest
12-
if: contains(github.actor, 'dependabot') == false
13+
if: github.event.pull_request.head.repo.full_name == github.repository || github.event.inputs.onDemand == 'yes'
1314
steps:
14-
- name: Checkout Master
15+
- name: Checkout
1516
uses: actions/checkout@v3
1617
with:
1718
fetch-depth: 0
19+
1820
- name: Use Node
19-
uses: actions/setup-node@v2
20-
with:
21-
node-version: 18
22-
- name: Configure Git Credentials
23-
run: |
24-
git config --global user.email "[email protected]"
25-
git config --global user.name "theguild-bot"
26-
echo "machine github.com login theguild-bot password ${{secrets.GH_API_TOKEN}}" > ~/.netrc
27-
- name: Setup NPM credentials
28-
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
29-
env:
30-
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
31-
- uses: actions/cache@v2
32-
name: Cache node_modules
21+
uses: actions/setup-node@v3
3322
with:
34-
path: '**/node_modules'
35-
key: ${{ runner.os }}-yarn-18-16-${{ hashFiles('**/yarn.lock') }}
36-
restore-keys: |
37-
${{ runner.os }}-yarn-18-16
38-
${{ runner.os }}-yarn-18-
39-
${{ runner.os }}-yarn-
23+
node-version: 16
24+
cache: "yarn"
25+
4026
- name: Install Dependencies using Yarn
41-
run: yarn install --ignore-engines && git checkout yarn.lock
27+
run: yarn
28+
4229
- name: Release Canary
4330
id: canary
44-
uses: 'kamilkisiela/release-canary@master'
45-
if: github.repository == 'urigo/graphql-modules'
46-
with:
47-
npm-token: ${{ secrets.NODE_AUTH_TOKEN }}
48-
npm-script: 'yarn release:canary'
49-
changesets: true
50-
- name: Publish a message
51-
if: steps.canary.outputs.released
52-
uses: 'kamilkisiela/pr-comment@master'
31+
uses: "the-guild-org/changesets-snapshot-action@main"
5332
with:
54-
message: |
55-
The latest changes of this PR are available as alpha in npm (based on the declared `changesets`):
56-
57-
```
58-
${{ steps.canary.outputs.changesetsPublishedPackages}}
59-
```
60-
bot-token: ${{ secrets.GH_API_TOKEN }}
61-
bot: 'theguild-bot'
62-
github-token: ${{ secrets.GITHUB_TOKEN }}
63-
- name: Publish a empty message
64-
if: steps.canary.outputs.released == 'false'
65-
uses: 'kamilkisiela/pr-comment@master'
66-
with:
67-
message: |
68-
The latest changes of this PR are not available as alpha, since there are no linked `changesets` for this PR.
69-
70-
$ yarn pr
71-
72-
Describe changes introduced in this Pull Request by running the above command.
73-
bot-token: ${{ secrets.GH_API_TOKEN }}
74-
bot: 'theguild-bot'
75-
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
tag: alpha
34+
prepareScript: "yarn build"
35+
env:
36+
NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/dependencies.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Dependencies Changeset
2+
3+
on: pull_request
4+
5+
jobs:
6+
changeset:
7+
if: github.event.pull_request.head.repo.full_name == github.repository
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Create/Update Changesets
16+
uses: "the-guild-org/changesets-dependencies-action@main"
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

+28-34
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,48 @@
11
name: Release
2+
23
on:
34
push:
45
branches:
56
- master
7+
68
jobs:
7-
build:
9+
release:
10+
name: stable
811
runs-on: ubuntu-latest
912
steps:
10-
- name: Checkout Master
13+
- name: Checkout
1114
uses: actions/checkout@v3
1215
with:
1316
fetch-depth: 0
14-
- name: Configure Git Credentials
15-
run: |
16-
git config --global user.email "[email protected]"
17-
git config --global user.name "theguild-bot"
18-
echo "machine github.com login theguild-bot password ${{secrets.GH_API_TOKEN}}" > ~/.netrc
19-
- name: Add origin remote and refetch master
20-
run: |
21-
git remote rm origin
22-
git remote add origin "https://github.com/${{github.repository}}"
23-
git fetch
24-
git checkout master
25-
git reset --hard
17+
2618
- name: Use Node
27-
uses: actions/setup-node@v2
19+
uses: actions/setup-node@v3
2820
with:
29-
node-version: 18
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-
- uses: actions/cache@v2
35-
name: Cache node_modules
36-
with:
37-
path: '**/node_modules'
38-
key: ${{ runner.os }}-yarn-18-16-${{ hashFiles('**/yarn.lock') }}
39-
restore-keys: |
40-
${{ runner.os }}-yarn-18-16-
41-
${{ runner.os }}-yarn-18-
42-
${{ runner.os }}-yarn-
21+
node-version: 16
22+
cache: "yarn"
23+
4324
- name: Install Dependencies using Yarn
44-
run: yarn install --ignore-engines && git checkout yarn.lock
25+
run: yarn
26+
27+
- name: Build Packages
28+
run: yarn build
29+
30+
- name: set version variables
31+
id: vars
32+
shell: bash
33+
run: |
34+
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
35+
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
36+
4537
- name: Create Release Pull Request or Publish to npm
4638
id: changesets
47-
uses: changesets/action@master
39+
uses: dotansimha/changesets-action@v1.3.1
4840
with:
4941
publish: yarn release
50-
commit: 'chore(release): update monorepo packages versions'
51-
title: 'Upcoming Release Changes'
42+
commit: "chore(release): update monorepo packages versions"
43+
title: "Upcoming Release Changes"
44+
createGithubReleases: aggregate
45+
githubReleaseName: "Release ${{ steps.vars.outputs.sha_short }} (from ${{ steps.vars.outputs.branch }})"
5246
env:
5347
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
48+
NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"test": "jest",
1717
"prerelease": "yarn build",
1818
"release": "changeset publish",
19-
"release:canary": "(node scripts/canary-release.js && yarn build && yarn changeset publish --tag alpha) || echo Skipping Canary...",
2019
"format": "prettier --ignore-path .gitignore --write \"packages/**/*.{js,jsx,json,css,md,mdx,ts,tsx}\"",
2120
"pr": "changeset",
2221
"lint": "eslint \"packages/**/*.{js,jsx,ts,tsx}\"",
@@ -30,8 +29,8 @@
3029
"@babel/preset-typescript": "7.17.12",
3130
"@babel/plugin-proposal-decorators": "7.18.2",
3231
"@babel/plugin-proposal-class-properties": "7.17.12",
33-
"@changesets/apply-release-plan": "5.0.1",
34-
"@changesets/cli": "2.23.0",
32+
"@changesets/cli": "2.24.2",
33+
"@changesets/changelog-github": "0.4.6",
3534
"@envelop/graphql-modules": "3.3.3",
3635
"@graphql-tools/merge": "8.2.14",
3736
"@graphql-yoga/node": "2.9.2",

patches/@changesets+apply-release-plan+5.0.1.patch

-79
This file was deleted.

0 commit comments

Comments
 (0)