-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 2.39 KB
/
Copy pathpullSchemaAndRelease.yml
File metadata and controls
77 lines (65 loc) · 2.39 KB
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
name: Release on new schema
on:
workflow_dispatch:
jobs:
update-schema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install gqlg
run: npm install -g gql-generator
- name: Generate queries and mutations
run: |
gqlg --schemaFilePath public-beta.graphql --destDirPath ./queries-mutations --depthLimit 3
- name: Install python dependencies
run: |
pip install ariadne-codegen
- name: Run initial codegen
run: ariadne-codegen
- name: Increment version
id: version
run: |
python3 -c '
import re
with open("setup.py", "r") as f:
content = f.read()
version_match = re.search(r"version=\'(\d+\.\d+\.\d+)\'", content)
if version_match:
major, minor, patch = map(int, version_match.group(1).split("."))
new_version = f"{major}.{minor + 1}.{patch}"
new_content = re.sub(r"version=\'(\d+\.\d+\.\d+)\'", f"version=\'{new_version}\'", content)
with open("setup.py", "w") as f:
f.write(new_content)
print(f"Version incremented to {new_version}")
print(f"::set-output name=new_version::{new_version}")
else:
print("No version found in setup.py")
exit(1)
'
- name: Create distribution package
run: python setup.py sdist
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add public-beta.graphql queries-mutations/ frontify/ setup.py
git commit -m "chore: update schema and increment version" || exit 0
git push
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.new_version }}
name: Release v${{ steps.version.outputs.new_version }}
body: |
This release includes the updated GraphQL schema and code generation.
files: |
dist/*.tar.gz