Skip to content

Commit 4aef2fe

Browse files
authored
Fix: CI release (#36)
2 parents 59ebc72 + addcbe5 commit 4aef2fe

7 files changed

Lines changed: 69 additions & 63 deletions

File tree

.devcontainer/Dockerfile.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /builder
44

55
COPY . .
66
RUN pip install -e .[dist]
7-
RUN ./bin/package.sh
7+
RUN pyinstaller --onefile pyinstaller_entrypoint.py --name hashfields
88

99
FROM python:3.11
1010

.github/workflows/pypi.yml

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

.github/workflows/release.yml

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ on:
44
workflow_dispatch:
55
push:
66
tags:
7-
- "202[2-9].0[1-9].[1-9]" # 2022.02.2
8-
- "202[2-9].0[1-9].[1-9][0-9]" # 2022.02.22
9-
- "202[2-9].1[0-2].[1-9]" # 2022.11.1
10-
- "202[2-9].1[0-2].[1-9][0-9]" # 2022.11.11
7+
- "202[3-9].0[1-9].[1-9]" # 2023.02.2
8+
- "202[3-9].0[1-9].[1-9]-rc[0-9]+" # 2023.02.2-rc1
9+
- "202[3-9].0[1-9].[1-9][0-9]" # 2023.02.22
10+
- "202[3-9].0[1-9].[1-9][0-9]-rc[0-9]+" # 2023.02.22-rc1
11+
- "202[3-9].1[0-2].[1-9]" # 2023.11.1
12+
- "202[3-9].1[0-2].[1-9]-rc[0-9]+" # 2023.11.1-rc1
13+
- "202[3-9].1[0-2].[1-9][0-9]" # 2023.11.11
14+
- "202[3-9].1[0-2].[1-9][0-9]-rc[0-9]+" # 2023.11.11-rc1
1115

1216
defaults:
1317
run:
@@ -39,18 +43,15 @@ jobs:
3943
run: ./bin/coverage.sh
4044

4145
- name: Package
42-
run: ./bin/package.sh
46+
run: pyinstaller --onefile pyinstaller_entrypoint.py --name hashfields
4347

4448
- name: Make artifact path
4549
id: make-path
4650
env:
4751
ref: ${{ github.ref }}
48-
os: ${{ matrix.os }}
52+
runner: ${{ runner.os }}
4953
run: |
50-
# strip off the -latest, replace ubuntu with linux
51-
os=${os/-latest/}
52-
os=${os/ubuntu/linux}
53-
echo "path=hashfields-${ref/refs\/tags\//}-${os}.zip" >> $GITHUB_OUTPUT
54+
echo "path=hashfields-${ref/refs\/tags\//}-${runner}.zip" >> $GITHUB_OUTPUT
5455
5556
- name: Zip (Linux)
5657
if: runner.os != 'Windows'
@@ -80,18 +81,64 @@ jobs:
8081

8182
needs: package
8283

84+
permissions:
85+
# https://github.com/softprops/action-gh-release#permissions
86+
contents: write
87+
8388
steps:
8489
- name: Checkout
8590
uses: actions/checkout@v4
8691

92+
- uses: actions/setup-python@v4
93+
with:
94+
python-version-file: .github/workflows/.python-version
95+
cache: pip
96+
cache-dependency-path: "**/pyproject.toml"
97+
98+
- name: Install build dependencies
99+
run: pip install -e .[dist]
100+
101+
- name: Build package
102+
run: |
103+
python -m build
104+
ls -al ./dist
105+
87106
- name: Download artifacts
88107
uses: actions/download-artifact@v3
89108
with:
90109
name: package
91110
path: ./package
92111

112+
- name: Check artifacts
113+
run: |
114+
ls -al ./package
115+
93116
- name: Release
117+
id: release
94118
uses: softprops/action-gh-release@v1
95119
with:
96-
files: "./package/*.zip"
97-
token: ${{ secrets.PAT_RELEASE }}
120+
files: |
121+
./dist/*.whl
122+
./dist/*.tar.gz
123+
./package/*.zip
124+
prerelease: ${{ contains(github.ref, '-rc') }}
125+
generate_release_notes: ${{ !contains(github.ref, '-rc') }}
126+
127+
- name: Publish to Test PyPI
128+
uses: pypa/gh-action-pypi-publish@release/v1.5
129+
if: ${{ contains(github.ref, '-rc') }}
130+
with:
131+
user: __token__
132+
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
133+
repository_url: https://test.pypi.org/legacy/
134+
print_hash: true
135+
skip_existing: true
136+
verbose: true
137+
138+
- name: Publish to PyPI
139+
uses: pypa/gh-action-pypi-publish@release/v1.5
140+
if: ${{ !contains(github.ref, '-rc') }}
141+
with:
142+
user: __token__
143+
password: ${{ secrets.PYPI_API_TOKEN }}
144+
print_hash: true

bin/package.sh

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

docs/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Or package the app for your current system:
3434
```console
3535
pip install -e .[dist]
3636

37-
./bin/package.sh
37+
pyinstaller --onefile pyinstaller_entrypoint.py --name hashfields
3838
```
3939

4040
The resulting executable is located at `./dist/hashfields`:

hashfields/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2023.08.4"
1+
__version__ = "2023.09.1"

pyinstaller_entrypoint.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""Pyinstaller entrypoint for the CLI."""
2+
3+
from hashfields.main import main
4+
5+
6+
if __name__ == "__main__":
7+
main()

0 commit comments

Comments
 (0)