Skip to content

Commit 0bb699d

Browse files
committed
ci: create release pipeline
1 parent de0b08c commit 0bb699d

File tree

4 files changed

+167
-3
lines changed

4 files changed

+167
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v3
21+
22+
- name: Set up Python 3
23+
run: uv python install 3.12
24+
25+
- name: Install the latest version of rye
26+
uses: eifinger/setup-rye@v4
27+
28+
- name: Install dependencies
29+
run: rye sync
30+
31+
- name: Install dependencies
32+
run: rye install git-cliff --force
33+
34+
- name: Determine next version
35+
id: get_version
36+
run: |
37+
NEW_VERSION=$(rye run git-cliff --bumped-version)
38+
echo "QLIENT_NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
39+
40+
- name: Generate a changelog
41+
uses: orhun/git-cliff-action@v4
42+
id: git-cliff
43+
with:
44+
config: cliff.toml
45+
args: --verbose --tag="$QLIENT_NEW_VERSION" --unreleased
46+
env:
47+
OUTPUT: CHANGELOG.md
48+
49+
- name: Build package
50+
run: rye build --all --clean
51+
52+
- name: Create and push the new tag
53+
run: |
54+
git config --global user.name 'github-actions[bot]'
55+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
56+
git tag $QLIENT_NEW_VERSION
57+
git push origin $QLIENT_NEW_VERSION
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Create Release
62+
id: create_release
63+
uses: softprops/action-gh-release@v2
64+
with:
65+
tag_name: $QLIENT_NEW_VERSION
66+
name: $QLIENT_NEW_VERSION
67+
draft: true
68+
prerelease: true
69+
body_path: CHANGELOG.md
70+
files: |
71+
dist/*
72+
generate_release_notes: false
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/qa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Python QA
1+
name: QA
22

33
on:
44
push:

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: Qlient Core - Test
1+
name: Test
22

33
on:
44
pull_request:
5-
branches: [ "main" ]
5+
branches:
6+
- main
67

78
jobs:
89
test:

cliff.toml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
[remote.github]
2+
owner = "graphqlient"
3+
repo = "qlient"
4+
5+
[changelog]
6+
body = """
7+
## What's Changed
8+
9+
{%- if version %} in {{ version }}{%- endif -%}
10+
{% for group, commits in commits | group_by(attribute="group") %}
11+
### {{ group | upper_first }}
12+
{%- for commit in commits %}
13+
{% if commit.remote.pr_title -%}
14+
{%- set commit_message = commit.remote.pr_title -%}
15+
{%- else -%}
16+
{%- set commit_message = commit.message -%}
17+
{%- endif -%}
18+
* {{ commit_message | split(pat="\n") | first | trim }}\
19+
{% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%}
20+
{% if commit.remote.pr_number %} in \
21+
[#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) \
22+
{%- endif %}
23+
{%- endfor -%}
24+
{%- endfor -%}
25+
26+
{%- if github -%}
27+
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
28+
{% raw %}\n{% endraw -%}
29+
## New Contributors
30+
{%- endif %}\
31+
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
32+
* @{{ contributor.username }} made their first contribution
33+
{%- if contributor.pr_number %} in \
34+
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
35+
{%- endif %}
36+
{%- endfor -%}
37+
{%- endif -%}
38+
39+
{% if version %}
40+
{% if previous.version %}
41+
**Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}
42+
{% endif %}
43+
{% else -%}
44+
{% raw %}\n{% endraw %}
45+
{% endif %}
46+
47+
{%- macro remote_url() -%}
48+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
49+
{%- endmacro -%}
50+
"""
51+
# remove the leading and trailing whitespace from the template
52+
trim = true
53+
# template for the changelog footer
54+
footer = """"""
55+
# postprocessors
56+
postprocessors = []
57+
58+
[git]
59+
# parse the commits based on https://www.conventionalcommits.org
60+
conventional_commits = true
61+
# filter out the commits that are not conventional
62+
filter_unconventional = true
63+
# process each line of a commit as an individual commit
64+
split_commits = false
65+
# regex for preprocessing the commit messages
66+
commit_preprocessors = [
67+
# remove issue numbers from commits
68+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
69+
]
70+
# regex for parsing and grouping commits
71+
commit_parsers = [
72+
{ message = "^feat", group = "<!-- 0 -->⛰️ Features" },
73+
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
74+
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
75+
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
76+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
77+
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
78+
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
79+
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
80+
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
81+
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
82+
]
83+
84+
# filter out the commits that are not matched by commit parsers
85+
filter_commits = false
86+
# sort the tags topologically
87+
topo_order = false
88+
# sort the commits inside sections by oldest/newest order
89+
sort_commits = "newest"

0 commit comments

Comments
 (0)