Skip to content

Commit 2cf37f9

Browse files
authored
ci: Automate releases (#643)
1 parent f372037 commit 2cf37f9

File tree

4 files changed

+82
-24
lines changed

4 files changed

+82
-24
lines changed

.github/workflows/pythonpublish.yml

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

.github/workflows/release-dry-run.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release Dry Run
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
token: ${{ secrets.PAT }}
16+
- uses: actions-rs/toolchain@v1
17+
with:
18+
profile: minimal
19+
toolchain: stable
20+
- uses: Swatinem/rust-cache@v1
21+
- name: Install Knope
22+
uses: actions-rs/cargo@v1
23+
with:
24+
command: install
25+
args: knope
26+
- run: knope release --dry-run

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
with:
11+
fetch-depth: 0
12+
token: ${{ secrets.PAT }}
13+
- name: Import GPG key
14+
uses: crazy-max/ghaction-import-gpg@v5
15+
with:
16+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
17+
git_user_signingkey: true
18+
git_commit_gpgsign: true
19+
git_push_gpgsign: false
20+
- uses: actions-rs/toolchain@v1
21+
with:
22+
profile: minimal
23+
toolchain: stable
24+
- uses: Swatinem/rust-cache@v1
25+
- name: Install Knope
26+
uses: actions-rs/cargo@v1
27+
with:
28+
command: install
29+
args: knope
30+
- name: Bump Version & Create GitHub Release
31+
run: knope release
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.PAT }}
34+
- name: Setup Poetry
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install --upgrade poetry
38+
poetry config http-basic.pypi __token__ ${{ secrets.PYPI_TOKEN }}
39+
- name: Push to PyPI
40+
run: poetry publish --build

knope.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ name = "release"
1919
type = "Command"
2020
command = "npx prettier --write CHANGELOG.md"
2121

22+
[[workflows.steps]]
23+
type = "Command"
24+
command = "git add pyproject.toml CHANGELOG.md"
25+
26+
[[workflows.steps]]
27+
type = "Command"
28+
command = "git commit -m \"chore: Bump to version\""
29+
variables = { "version" = "Version" }
30+
31+
[[workflows.steps]]
32+
type = "Command"
33+
command = "git push"
34+
35+
[[workflows.steps]]
36+
type = "Release"
37+
2238
[github]
2339
owner = "openapi-generators"
2440
repo = "openapi-python-client"

0 commit comments

Comments
 (0)