@@ -2,68 +2,89 @@ name: Canary Release
2
2
3
3
on :
4
4
pull_request :
5
- branches :
6
- - master
5
+ branches : [master]
7
6
8
7
jobs :
8
+ changes :
9
+ name : Check Changeset
10
+ runs-on : ubuntu-latest
11
+ outputs :
12
+ # Set job outputs to value from filter step
13
+ wasChangesetChanged : ${{steps.filter.outputs.changeset}}
14
+ 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
9
22
publish-canary :
10
23
name : Publish Canary
11
24
runs-on : ubuntu-latest
12
- if : github.event.pull_request.head.repo.full_name == github.repository
25
+ needs : changes
26
+ if : github.event.pull_request.head.repo.full_name == github.repository && needs.changes.outputs.wasChangesetChanged == 'true'
13
27
steps :
14
28
- name : Checkout Master
15
29
uses : actions/checkout@v3
16
30
with :
17
31
fetch-depth : 0
32
+
18
33
- name : Use Node
19
34
uses : actions/setup-node@v3
20
35
with :
21
- node-version : ' 16.x'
36
+ node-version : 16
37
+
22
38
- name : Configure Git Credentials
23
39
run : |
24
40
git config --global user.email "[email protected] "
25
41
git config --global user.name "theguild-bot"
26
42
echo "machine github.com login theguild-bot password ${{secrets.GH_API_TOKEN}}" > ~/.netrc
43
+
27
44
- name : Setup NPM credentials
28
45
run : echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
29
46
env :
30
- NODE_AUTH_TOKEN : ${{ secrets.NODE_AUTH_TOKEN }}
47
+ NODE_AUTH_TOKEN : ${{secrets.NODE_AUTH_TOKEN}}
48
+
31
49
- name : Cache Yarn
32
50
uses : actions/cache@v3
33
51
with :
34
52
path : ' **/node_modules'
35
- key : ${{ runner.os }}-16-8-16-node-modules-${{ hashFiles('yarn.lock') }}
53
+ key : ${{runner.os}}-16-8-16-node-modules-${{hashFiles('yarn.lock')}}
36
54
restore-keys : |
37
- ${{ runner.os }}-16-8-16-node-modules-${{ hashFiles('yarn.lock') }}
38
- ${{ runner.os }}-16-8-16-node-modules-
39
- - name : Install Dependencies using Yarn
40
- run : yarn install && git checkout yarn.lock && yarn patch-package
55
+ ${{runner.os}}-16-8-16-node-modules-${{hashFiles('yarn.lock')}}
56
+ ${{runner.os}}-16-8-16-node-modules-
57
+
58
+ - name : Install Dependencies
59
+ run : yarn
60
+
41
61
- name : Release Canary
42
62
id : canary
43
63
uses : ' kamilkisiela/release-canary@master'
44
64
if : github.repository == 'B2o5T/graphql-eslint'
45
65
with :
46
- npm-token : ${{ secrets.NODE_AUTH_TOKEN }}
66
+ npm-token : ${{secrets.NODE_AUTH_TOKEN}}
47
67
npm-script : ' yarn release:canary'
48
68
changesets : true
69
+
49
70
- name : Publish a message
50
71
if : steps.canary.outputs.released
51
72
uses : ' kamilkisiela/pr-comment@master'
52
73
with :
53
74
message : |
54
75
The latest changes of this PR are available as alpha in npm (based on the declared `changesets`):
55
76
```
56
- ${{ steps.canary.outputs.changesetsPublishedPackages}}
77
+ ${{steps.canary.outputs.changesetsPublishedPackages}}
57
78
```
58
- bot-token : ${{ secrets.GH_API_TOKEN }}
59
- bot : ' theguild-bot'
60
- github-token : ${{ secrets.GITHUB_TOKEN }}
61
- - name : Publish a empty message
79
+ bot-token : ${{secrets.GH_API_TOKEN}}
80
+ bot : theguild-bot
81
+ github-token : ${{secrets.GITHUB_TOKEN}}
82
+
83
+ - name : Publish an empty message
62
84
if : steps.canary.outputs.released == 'false'
63
85
uses : ' kamilkisiela/pr-comment@master'
64
86
with :
65
- message : |
66
- The latest changes of this PR are not available as alpha, since there are no linked `changesets` for this PR.
67
- bot-token : ${{ secrets.GH_API_TOKEN }}
68
- bot : ' theguild-bot'
69
- github-token : ${{ secrets.GITHUB_TOKEN }}
87
+ message : The latest changes of this PR are not available as alpha, since there are no linked `changesets` for this PR.
88
+ bot-token : ${{secrets.GH_API_TOKEN}}
89
+ bot : theguild-bot
90
+ github-token : ${{secrets.GITHUB_TOKEN}}
0 commit comments