Skip to content

Commit 4631d27

Browse files
authored
97 automatically build and push to pypi (#426)
* Start release workflow * Build and publish to python package on tag push * Make release * Rename code quality and add commit of linting fixes * Add missing colon * Parallel code quality * Remove testpypi from release * Remove type check from analysis job * Rename build docs
1 parent 4320154 commit 4631d27

File tree

3 files changed

+108
-18
lines changed

3 files changed

+108
-18
lines changed

.github/workflows/build-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
workflow_call:
88

99
jobs:
10-
build:
11-
name: Build
10+
build-docs:
11+
name: Build Documentation
1212

1313
runs-on: ubuntu-latest
1414

Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
name: Auto Format and Lint
1+
name: Code Quality
22

33
on:
44
pull_request:
55
push:
66
branches:
77
- main
8-
merge_group:
98

109
jobs:
11-
autoformat-and-lint:
12-
name: Auto Format and Lint
10+
static-analysis:
11+
name: Static Analysis
1312
if: github.actor != 'dependabot[bot]'
1413
runs-on: ubuntu-latest
1514
permissions:
@@ -22,27 +21,39 @@ jobs:
2221
ref: ${{ github.head_ref }}
2322
token: ${{ secrets.WORKFLOW_COMMIT }}
2423

25-
- name: 🐍 Setup Python
26-
uses: actions/setup-python@v5
27-
with:
28-
python-version: "3.13"
29-
cache: "pip"
30-
3124
- name: 📦 Install Hatch
3225
uses: pypa/hatch@install
3326

3427
- name: 📝 Format Code
35-
run: hatch fmt -f
28+
run: hatch fmt
3629

37-
- name: ✅ Commit code format changes
30+
- name: ✅ Commit Code Format Changes
3831
uses: stefanzweifel/git-auto-commit-action@v5
3932
with:
40-
commit_message: "Auto format code"
33+
commit_message: "Hatch static analysis"
4134
skip_fetch: true
4235
skip_checkout: true
36+
37+
type-check:
38+
name: Type Check
39+
if: github.actor != 'dependabot[bot]'
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- name: 🛎 Checkout
44+
uses: actions/checkout@v4
45+
with:
46+
ref: ${{ github.head_ref }}
47+
token: ${{ secrets.WORKFLOW_COMMIT }}
4348

44-
- name: 🧶 Lint
45-
run: hatch fmt --check
49+
- name: 🐍 Setup Python
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: "3.13"
53+
cache: "pip"
54+
55+
- name: 📦 Install Hatch
56+
uses: pypa/hatch@install
4657

4758
- name: 🔍 Type Check
48-
run: hatch run check
59+
run: hatch run check

.github/workflows/release.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Release Version
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
# Publish Python package to PyPI.
10+
publish-to-pypi:
11+
name: Publish to PyPI
12+
13+
runs-on: ubuntu-latest
14+
15+
environment:
16+
name: pypi
17+
url: https://pypi.org/p/ephys-link
18+
19+
permissions:
20+
id-token: write
21+
22+
steps:
23+
- name: 🛎 Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.head_ref }}
27+
28+
- name: 🐍 Setup Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.13"
32+
cache: "pip"
33+
34+
- name: 📦 Install Hatch
35+
uses: pypa/hatch@install
36+
37+
- name: 🔨 Build Package
38+
run: hatch build
39+
40+
- name: 📦 Publish Distribution to PyPI
41+
uses: pypa/gh-action-pypi-publish@release/v1
42+
43+
# Build Windows executable and make release.
44+
build-and-release:
45+
name: Build Executable and Release
46+
47+
runs-on: windows-latest
48+
49+
steps:
50+
- name: 🛎 Checkout
51+
uses: actions/checkout@v4
52+
with:
53+
ref: ${{ github.head_ref }}
54+
55+
- name: 🐍 Setup Python
56+
uses: actions/setup-python@v5
57+
with:
58+
python-version: "3.13"
59+
cache: "pip"
60+
61+
- name: 📦 Install Hatch
62+
uses: pypa/hatch@install
63+
64+
- name: 🔨 Build Executable
65+
run: hatch run exe
66+
67+
- name: 🤐 Zip Build Folder
68+
# FIXME: Need correct CLI with correct folder name.
69+
run: Compress-Archive -Path dist/ephys-link-${{ github.ref_name }} -Destination dist/ephys-link-${{ github.ref_name }}.zip
70+
71+
- name: 📦 Make Release
72+
uses: ncipollo/release-action@v1
73+
with:
74+
tag: ${{ github.ref_name }}
75+
# FIXME: Use correct name.
76+
artifacts: "dist/ephys-link-${{ github.ref_name }}.zip,dist/ephys-link-${{ github.ref_name }}.exe"
77+
artifactErrorsFailBuild: true
78+
generateReleaseNotes: true
79+
prerelease: ${{ contains(github.ref_name, "a") || contains(github.ref_name, "b") || contains(github.ref_name, "c") || contains(github.ref_name, "d") }}

0 commit comments

Comments
 (0)