Skip to content

Commit

Permalink
🥑 ci
Browse files Browse the repository at this point in the history
  • Loading branch information
coolcode committed Feb 4, 2024
1 parent b922864 commit fcd99bc
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 58 deletions.
109 changes: 83 additions & 26 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python package
name: Publish Python 🐍 distribution 📦 to PyPI

on:
push:
Expand All @@ -8,33 +8,90 @@ on:

jobs:
build:

name: Build distribution 📦
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12.1]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# pip install -r requirements.txt
pip install setuptools wheel twine
python-version: "3.x"

- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: |
python setup.py sdist bdist_wheel
ls dist/
# - name: Test with pytest
# run: |
# pip install pytest
# pytest
# - name: Publish a Python distribution to PyPI
# uses: pypa/gh-action-pypi-publish@master
# with:
# user: __token__
# password: ${{ secrets.pypi_password }}
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/tomato-clock
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v1.2.3
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
69 changes: 37 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,58 @@
# 🍅 Tomato Clock

[![Python package CI tomato-clock](https://github.com/coolcode/tomato-clock/workflows/Python%20package/badge.svg?branch=master)](https://github.com/coolcode/tomato-clock/actions)
[![PyPI version tomato-clock](https://badge.fury.io/py/tomato-clock.svg)](https://pypi.python.org/pypi/tomato-clock/)

Tomato Clock is a simple command line pomodoro app.

Pomodoro 番茄工作法 https://en.wikipedia.org/wiki/Pomodoro_Technique
- [Pomodoro Technique](https://en.wikipedia.org/wiki/Pomodoro_Technique)
- [番茄工作法](https://zh.wikipedia.org/zh-cn/%E7%95%AA%E8%8C%84%E5%B7%A5%E4%BD%9C%E6%B3%95)

## Installation

Install python from https://www.python.org/
[Install python](https://www.python.org)

- Install via pip:
```
$ pip install tomato-clock

```sh
pip install tomato-clock
```

- Install via source code:
```
$ git clone https://github.com/coolcode/tomato-clock.git
$ cd tomato-clock
$ chmod +x tomato.py

```sh
git clone https://github.com/coolcode/tomato-clock.git
cd tomato-clock
chmod +x tomato.py
```

## How to use

- if you install via pip

```
$ tomato # start a 25 minutes tomato clock + 5 minutes break
$ tomato -t # start a 25 minutes tomato clock
$ tomato -t <n> # start a <n> minutes tomato clock
$ tomato -b # take a 5 minutes break
$ tomato -b <n> # take a <n> minutes break
$ tomato -h # help
```sh
tomato # start a 25 minutes tomato clock + 5 minutes break
tomato -t # start a 25 minutes tomato clock
tomato -t <n> # start a <n> minutes tomato clock
tomato -b # take a 5 minutes break
tomato -b <n> # take a <n> minutes break
tomato -h # help
```

- if you install via source code
```
$ ./tomato.py # start a 25 minutes tomato clock + 5 minutes break
$ ./tomato.py -t # start a 25 minutes tomato clock
$ ./tomato.py -t <n> # start a <n> minutes tomato clock
$ ./tomato.py -b # take a 5 minutes break
$ ./tomato.py -b <n> # take a <n> minutes break
$ ./tomato.py -h # help

```sh
./tomato.py # start a 25 minutes tomato clock + 5 minutes break
./tomato.py -t # start a 25 minutes tomato clock
./tomato.py -t <n> # start a <n> minutes tomato clock
./tomato.py -b # take a 5 minutes break
./tomato.py -b <n> # take a <n> minutes break
./tomato.py -h # help
```

## Terminal Output
```

```sh
🍅 tomato 25 minutes. Ctrl+C to exit
🍅🍅---------------------------------------------- [8%] 23:4 ⏰
```
Expand All @@ -56,8 +61,8 @@ $ ./tomato.py -h # help

- MacOS

```
$ brew install terminal-notifier
```sh
brew install terminal-notifier
```

`terminal-notifier` actually is a cross-platform desktop notifier, please refer to ➜ [terminal-notifier](https://github.com/julienXX/terminal-notifier#download)
Expand All @@ -71,9 +76,9 @@ $ brew install terminal-notifier
<img src="https://github.com/coolcode/tomato-clock/blob/master/img/screenshot-ubuntu.png?raw=true" alt="ubuntu-notification" width="300"/>


## Voice Notifications

## Voice Notification
We use `say`(text-to-speech) for voice notification
Tomato Clock uses `say`(text-to-speech) for voice notifications.

- MacOS

Expand All @@ -82,15 +87,15 @@ MacOS already has `say`. see [here](https://ss64.com/osx/say.html) or [more deta
- Ubuntu

see this link: [say](http://manpages.ubuntu.com/manpages/trusty/man1/say.1.html)
```

```sh
sudo apt-get install gnustep-gui-runtime
```


## Package & Publish
```

```sh
pip install setuptools wheel twine
rm -rf dist && python setup.py sdist bdist_wheel
twine upload dist/*
```

0 comments on commit fcd99bc

Please sign in to comment.