Skip to content

Commit e21ecda

Browse files
committed
Added deploy CI
1 parent 2cf1e84 commit e21ecda

File tree

2 files changed

+156
-0
lines changed

2 files changed

+156
-0
lines changed

.github/workflows/deploy.yaml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Deploy to PyPi
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
jobs:
7+
build:
8+
name: Build Wheels and Package 🛠️
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout Code
12+
uses: actions/checkout@v4
13+
- name: Set up Python 3.12
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.x"
17+
- name: Install UV
18+
run: python -m pip install uv
19+
- name: Build Module
20+
run: uv build
21+
- name: Store the distribution packages
22+
uses: actions/upload-artifact@v4
23+
with:
24+
retention-days: 1
25+
if-no-files-found: error
26+
name: python-package-distributions
27+
path: dist/
28+
publish_test:
29+
name: Publish to TestPyPi 🧪
30+
needs:
31+
- build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: test_pypi
35+
url: https://test.pypi.org/p/simvue-cli
36+
permissions:
37+
id-token: write
38+
steps:
39+
- name: Download all the dists
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: python-package-distributions
43+
path: dist/
44+
- name: Publish to TestPyPi
45+
uses: pypa/gh-action-pypi-publish@release/v1
46+
with:
47+
repository-url: https://test.pypi.org/legacy/
48+
publish:
49+
name: Publish to PyPi 🐍📦
50+
needs:
51+
- publish_test
52+
if: "!contains(github.ref, 'rc') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha')"
53+
runs-on: ubuntu-latest
54+
environment:
55+
name: pypi
56+
url: https://pypi.org/p/simvue-cli
57+
permissions:
58+
id-token: write
59+
steps:
60+
- name: Download all the dists
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: python-package-distributions
64+
path: dist/
65+
- name: Publish to PyPi
66+
uses: pypa/gh-action-pypi-publish@release/v1
67+
github-release:
68+
name: Create Signed GitHub Release 🔏
69+
needs:
70+
- publish
71+
runs-on: ubuntu-latest
72+
permissions:
73+
contents: write
74+
id-token: write
75+
steps:
76+
- name: Download all the dists
77+
uses: actions/download-artifact@v4
78+
with:
79+
name: python-package-distributions
80+
path: dist/
81+
- name: Sign the dists with Sigstore
82+
uses: sigstore/[email protected]
83+
with:
84+
inputs: >-
85+
./dist/*.tar.gz
86+
./dist/*.whl
87+
- name: Create GitHub Release
88+
env:
89+
GITHUB_TOKEN: ${{ github.token }}
90+
run: >-
91+
LATESTCHANGES=$(awk '
92+
BEGIN { header_found = 0 }
93+
/^## / {
94+
if (header_found == 0) {
95+
header = $0
96+
header_found = 1
97+
next
98+
} else {
99+
exit
100+
}
101+
}
102+
header_found == 1 && /^\* / { print }
103+
' CHANGELOG.md)
104+
gh release create
105+
'${{ github.ref_name }}'
106+
--notes "$LATESTCHANGES"
107+
--title 'Simvue CLI ${{ github.ref_name }}'
108+
--repo '${{ github.repository }}'
109+
- name: Upload artifact signatures to GitHub Release
110+
env:
111+
GITHUB_TOKEN: ${{ github.token }}
112+
run: >-
113+
gh release upload
114+
'${{ github.ref_name }}' dist/**
115+
--repo '${{ github.repository }}'

.pre-commit-config.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
exclude: '^tests|^docs|^examples|^notebooks'
2+
ci:
3+
autofix_prs: false
4+
autoupdate_branch: ''
5+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
6+
autoupdate_schedule: weekly
7+
skip: []
8+
submodules: false
9+
repos:
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v5.0.0
12+
hooks:
13+
- id: check-toml
14+
- id: check-yaml
15+
- id: pretty-format-json
16+
args: [--autofix]
17+
- id: trailing-whitespace
18+
language: python
19+
- id: check-merge-conflict
20+
- id: end-of-file-fixer
21+
- id: mixed-line-ending
22+
- id: no-commit-to-branch
23+
args: [--branch, main, --branch, dev]
24+
- id: check-added-large-files
25+
- repo: https://github.com/astral-sh/ruff-pre-commit
26+
rev: v0.11.2
27+
hooks:
28+
- id: ruff
29+
args: [ --fix, --exit-non-zero-on-fix, "--ignore=C901" ]
30+
- id: ruff-format
31+
- repo: https://github.com/conorfalvey/check_pdb_hook
32+
rev: 0.0.9
33+
hooks:
34+
- id: check_pdb_hook
35+
pass_filenames: false
36+
37+
- repo: https://github.com/PyCQA/bandit.git
38+
rev: 1.8.3
39+
hooks:
40+
- id: bandit
41+
args: [-lll, --recursive, clumper]

0 commit comments

Comments
 (0)