-
Notifications
You must be signed in to change notification settings - Fork 242
219 lines (176 loc) · 7.37 KB
/
cd.packages-stable.create-release-drafts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
name: CD | Create Monorepo Packages Stable Release Draft
on:
workflow_dispatch:
push:
branches:
- "dev"
paths:
- "packages/ethereum-contracts/**"
- "packages/subgraph/**"
- "packages/metadata/**"
- "packages/sdk-core/**"
- "packages/sdk-redux/**"
- ".github/workflows/cd.packages-stable.create-release-drafts.yml"
jobs:
create-ethereum-contracts-release-draft:
name: Create Ethereum-Contracts Release Draft
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- name: Check package versions
run: ./tasks/check-package-version.sh ethereum-contracts SHOULD_PUBLISH_ETHEREUM_CONTRACTS ETHEREUM_CONTRACTS_NEW_VERSION >> "$GITHUB_ENV"
- name: Create ethereum-contracts stable release draft
if: env.SHOULD_PUBLISH_ETHEREUM_CONTRACTS == 1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ethereum-contracts@v${{ env.ETHEREUM_CONTRACTS_NEW_VERSION }}
release_name: ethereum-contracts@v${{ env.ETHEREUM_CONTRACTS_NEW_VERSION }}
body_path: .github/RELEASE_TEMPLATE/release-notes.md
draft: true
create-subgraph-release-draft:
name: Create Subgraph Release Draft
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- name: Check package versions
run: |
SUBGRAPH_NEW_VERSION=$(jq -r .version packages/subgraph/package.json)
git fetch --prune --tags # github checkout action by default doesn't fetch these
if git tag | grep -e "^subgraph@v${SUBGRAPH_NEW_VERSION}$"; then
echo "subgraph version unchanged: $SUBGRAPH_NEW_VERSION" >&2
echo "SHOULD_PUBLISH_SUBGRAPH=0" >> "$GITHUB_ENV"
else
echo "subgraph changed: $SUBGRAPH_NEW_VERSION" >&2
echo "SHOULD_PUBLISH_SUBGRAPH=1" >> "$GITHUB_ENV"
echo "SUBGRAPH_NEW_VERSION=$SUBGRAPH_NEW_VERSION" >> "$GITHUB_ENV"
fi
- name: Create subgraph stable release draft
if: env.SHOULD_PUBLISH_SUBGRAPH == 1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: subgraph@v${{ env.SUBGRAPH_NEW_VERSION }}
release_name: subgraph@v${{ env.SUBGRAPH_NEW_VERSION }}
body_path: .github/RELEASE_TEMPLATE/release-notes.md
draft: true
create-and-publish-metadata-package:
name: Create Metadata Release Draft and Publish to NPM
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- name: Check package versions
run: ./tasks/check-package-version.sh metadata SHOULD_PUBLISH_METADATA METADATA_NEW_VERSION >> "$GITHUB_ENV"
- name: Create metadata stable release draft
if: env.SHOULD_PUBLISH_METADATA == 1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: metadata@v${{ env.METADATA_NEW_VERSION }}
release_name: metadata@v${{ env.METADATA_NEW_VERSION }}
body: |
Please refer to the CHANGELOG.md file in metadata package for more details on the changeset.
draft: false
- name: Publish metadata package
if: env.SHOULD_PUBLISH_METADATA == 1
run: |
yarn --cwd packages/metadata build
tasks/npm-publish.sh packages/metadata/ latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }}
check-sdk-core-version:
name: Checking if SDK-Core should be published
runs-on: ubuntu-latest
outputs:
publish_sdk_core: ${{ env.SHOULD_PUBLISH_SDK_CORE }}
sdk_core_new_version: ${{ env.SDK_CORE_NEW_VERSION }}
steps:
- uses: actions/checkout@v4
- name: Check package versions
run: ./tasks/check-package-version.sh sdk-core SHOULD_PUBLISH_SDK_CORE SDK_CORE_NEW_VERSION >> "$GITHUB_ENV"
test-sdk-core-query-schema-against-deployed-v1-subgraphs:
uses: ./.github/workflows/call.check-query-schema-against-subgraph.yml
needs: check-sdk-core-version
if: needs.check-sdk-core-version.outputs.publish_sdk_core == 1
name: Test SDK-Core Query Schema and Queries Against Deployed V1 Subgraphs
with:
subgraph-release: v1
test-sdk-core-with-v1-release-subgraph:
uses: ./.github/workflows/call.test-sdk-core.yml
needs: check-sdk-core-version
if: needs.check-sdk-core-version.outputs.publish_sdk_core == 1
name: Build and Test SDK-Core (Release branch)
with:
subgraph-release: v1
subgraph-endpoint: ""
run-coverage-tests: false
create-sdk-core-release-draft:
name: Create SDK-Core Release Draft
runs-on: ubuntu-latest
needs:
[
check-sdk-core-version,
]
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- name: Create sdk-core stable release draft
if: needs.check-sdk-core-version.outputs.publish_sdk_core == 1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: sdk-core@v${{ needs.check-sdk-core-version.outputs.sdk_core_new_version }}
release_name: sdk-core@v${{ needs.check-sdk-core-version.outputs.sdk_core_new_version }}
body_path: .github/RELEASE_TEMPLATE/release-notes.md
draft: true
create-sdk-redux-release-draft:
name: Create SDK-Redux Release Draft
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- name: Check package versions
run: ./tasks/check-package-version.sh sdk-redux SHOULD_PUBLISH_SDK_REDUX SDK_REDUX_NEW_VERSION >> "$GITHUB_ENV"
- name: Create sdk-redux stable release draft
if: env.SHOULD_PUBLISH_SDK_REDUX == 1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: sdk-redux@v${{ env.SDK_REDUX_NEW_VERSION }}
release_name: sdk-redux@v${{ env.SDK_REDUX_NEW_VERSION }}
body_path: .github/RELEASE_TEMPLATE/release-notes.md
draft: true