Skip to content

Commit 92f6543

Browse files
authored
improve pipelines and setup for GH Actions and changesets (#1124)
1 parent 0df197f commit 92f6543

File tree

9 files changed

+208
-302
lines changed

9 files changed

+208
-302
lines changed

.changeset/config.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
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",
43
"commit": false,
54
"linked": [],
65
"access": "restricted",
@@ -12,5 +11,10 @@
1211
"@graphql-eslint/example-graphql-config",
1312
"@graphql-eslint/example-graphql-config-code-file",
1413
"@graphql-eslint/example-prettier"
15-
]
14+
],
15+
"changelog": ["@changesets/changelog-github", { "repo": "B2o5T/graphql-eslint" }],
16+
"snapshot": {
17+
"useCalculatedVersion": true,
18+
"prereleaseTemplate": "{tag}-{datetime}-{commit}"
19+
}
1620
}

.github/workflows/canary.yml

Lines changed: 23 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,47 @@
1-
name: Canary Release
1+
name: snapshot
22

33
on:
44
pull_request:
5-
branches: [master]
5+
branches:
6+
- master
7+
paths:
8+
- '.changeset/**/*.md'
69

710
jobs:
8-
changes:
9-
name: Check Changeset
11+
release:
1012
runs-on: ubuntu-latest
11-
outputs:
12-
# Set job outputs to value from filter step
13-
wasChangesetChanged: ${{steps.filter.outputs.changeset}}
13+
if: github.event.pull_request.head.repo.full_name == github.repository
1414
steps:
15-
- name: Check if changeset has been modified
16-
uses: dorny/paths-filter@v2
17-
id: filter
18-
with:
19-
filters: |
20-
changeset:
21-
- added|modified: .changeset/*.md
22-
publish-canary:
23-
name: Publish Canary
24-
runs-on: ubuntu-latest
25-
needs: changes
26-
if: github.event.pull_request.head.repo.full_name == github.repository && needs.changes.outputs.wasChangesetChanged == 'true'
27-
steps:
28-
- name: Checkout Master
15+
- name: Checkout
2916
uses: actions/checkout@v3
3017
with:
3118
fetch-depth: 0
3219

3320
- name: Use Node
3421
uses: actions/setup-node@v3
3522
with:
36-
node-version: 16
37-
38-
- name: Configure Git Credentials
39-
run: |
40-
git config --global user.email "[email protected]"
41-
git config --global user.name "theguild-bot"
42-
echo "machine github.com login theguild-bot password ${{secrets.GH_API_TOKEN}}" > ~/.netrc
43-
44-
- name: Setup NPM credentials
45-
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
46-
env:
47-
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
23+
node-version: 18
24+
cache: yarn
4825

49-
- name: Cache Yarn
26+
- name: Cache Node Modules
5027
uses: actions/cache@v3
28+
id: node-modules-cache-canary
5129
with:
5230
path: '**/node_modules'
53-
key: ${{runner.os}}-16-16-node-modules-${{hashFiles('yarn.lock')}}
31+
key: ${{runner.os}}-18-node-modules-${{hashFiles('yarn.lock')}}
5432
restore-keys: |
55-
${{runner.os}}-16-16-node-modules-
33+
${{runner.os}}-18-node-modules-
5634
57-
- name: Install Dependencies
58-
run: yarn
35+
- name: Install Dependencies using Yarn
36+
run: yarn install --ignore-engines --frozen-lockfile --immutable
37+
if: steps.node-modules-cache-canary.outputs.cache-hit != 'true'
5938

6039
- name: Release Canary
6140
id: canary
62-
uses: kamilkisiela/release-canary@master
63-
if: github.repository == 'B2o5T/graphql-eslint'
41+
uses: 'the-guild-org/changesets-snapshot-action@main'
6442
with:
65-
npm-token: ${{secrets.NODE_AUTH_TOKEN}}
66-
npm-script: 'yarn release:canary'
67-
changesets: true
68-
69-
- name: Publish a message
70-
if: steps.canary.outputs.released
71-
uses: kamilkisiela/pr-comment@master
72-
with:
73-
message: |
74-
The latest changes of this PR are available as alpha in npm (based on the declared `changesets`):
75-
```
76-
${{steps.canary.outputs.changesetsPublishedPackages}}
77-
```
78-
bot: theguild-bot
79-
bot-token: ${{secrets.GH_API_TOKEN}}
80-
github-token: ${{secrets.GITHUB_TOKEN}}
81-
82-
- name: Publish an empty message
83-
if: steps.canary.outputs.released == 'false'
84-
uses: kamilkisiela/pr-comment@master
85-
with:
86-
bot: theguild-bot
87-
bot-token: ${{secrets.GH_API_TOKEN}}
88-
github-token: ${{secrets.GITHUB_TOKEN}}
89-
message: The latest changes of this PR are not available as alpha, since there are no linked `changesets` for this PR.
43+
tag: alpha
44+
prepareScript: 'yarn build'
45+
env:
46+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: dependencies
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
7+
jobs:
8+
changeset:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Create/Update Changesets
17+
uses: 'the-guild-org/changesets-dependencies-action@main'
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,35 @@ jobs:
77
build:
88
runs-on: ubuntu-latest
99
steps:
10-
- name: Checkout Master
10+
- name: Checkout
1111
uses: actions/checkout@v3
1212
with:
1313
fetch-depth: 0
1414

15-
- name: Configure Git Credentials
16-
run: |
17-
git config --global user.email "[email protected]"
18-
git config --global user.name "theguild-bot"
19-
echo "machine github.com login theguild-bot password ${{secrets.GH_API_TOKEN}}" > ~/.netrc
20-
21-
- name: Add origin remote and refetch master
22-
run: |
23-
git remote rm origin
24-
git remote add origin "https://github.com/${{github.repository}}"
25-
git fetch
26-
git checkout master
27-
git reset --hard
28-
2915
- name: Use Node
3016
uses: actions/setup-node@v3
3117
with:
32-
node-version: 16
33-
34-
- name: Setup NPM credentials
35-
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
36-
env:
37-
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
18+
node-version: 18
3819

3920
- name: Cache Yarn
4021
uses: actions/cache@v3
4122
with:
4223
path: '**/node_modules'
43-
key: ${{runner.os}}-16-16-node-modules-${{hashFiles('yarn.lock')}}
24+
key: ${{runner.os}}-18-18-node-modules-${{hashFiles('yarn.lock')}}
4425
restore-keys: |
45-
${{runner.os}}-16-16-node-modules-
26+
${{runner.os}}-18-18-node-modules-
4627
4728
- name: Install Dependencies
4829
run: yarn
4930

5031
- name: Create Release Pull Request or Publish to npm
5132
id: changesets
52-
uses: changesets/action@v1
33+
uses: dotansimha/changesets-action@262e957f99be29087d2b13afa32a5d579bf1d080
5334
with:
54-
publish: yarn release
35+
publish: 'yarn release'
5536
commit: 'chore(release): update monorepo packages versions'
56-
title: Upcoming Release Changes
37+
title: 'Upcoming Release Changes'
38+
createGithubReleases: aggregate
5739
env:
58-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
59-
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
"test": "jest --no-watchman --forceExit --noStackTrace --detectOpenHandles",
2020
"prerelease": "yarn build",
2121
"release": "changeset publish",
22-
"release:canary": "ts-node scripts/canary-release.ts && yarn build && yarn changeset publish --tag alpha",
2322
"prettier": "prettier --ignore-path .gitignore --write --list-different \"**/*.{ts,tsx,graphql,yml}\""
2423
},
2524
"devDependencies": {
2625
"@babel/core": "7.18.5",
2726
"@babel/preset-env": "7.18.2",
2827
"@babel/preset-typescript": "7.17.12",
29-
"@changesets/cli": "2.23.0",
28+
"@changesets/cli": "2.24.1",
29+
"@changesets/changelog-github": "0.4.6",
3030
"@swc/core": "1.2.203",
3131
"@swc/jest": "0.2.21",
3232
"@types/dedent": "0.7.0",

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

Lines changed: 0 additions & 48 deletions
This file was deleted.

renovate.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"extends": ["config:base"],
3+
"postUpdateOptions": ["yarnDedupeFewer"],
4+
"automerge": false,
5+
"labels": ["dependencies"],
6+
"packageRules": [
7+
{
8+
"matchDepTypes": ["devDependencies"],
9+
"prPriority": -1
10+
},
11+
{
12+
"matchPackagePatterns": ["^@theguild/", "^@guild-docs/"],
13+
"prPriority": 5
14+
},
15+
{
16+
"excludePackageNames": [
17+
"@changesets/cli",
18+
"@changesets/apply-release-plan",
19+
"@changesets/assemble-release-plan",
20+
"typescript"
21+
],
22+
"matchPackagePatterns": ["*"],
23+
"matchUpdateTypes": ["minor", "patch"],
24+
"groupName": "all non-major dependencies",
25+
"groupSlug": "all-minor-patch"
26+
},
27+
{
28+
"matchPackageNames": "typescript",
29+
"automerge": false
30+
}
31+
],
32+
"timezone": "Europe/Warsaw",
33+
"schedule": ["after 10pm and before 6:00am"],
34+
"ignorePaths": ["**/__tests__/**", "**/test/**", "**/tests/**", "**/__fixtures__/**"]
35+
}

scripts/canary-release.ts

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)