feat: add get_file_hash function #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3 | |
- name: Install poetry | |
run: | | |
pip install poetry | |
- name: Configure poetry | |
run: | | |
poetry config virtualenvs.in-project true | |
- name: Cache the virtualenv | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Version tag and build | |
run: | | |
DATE=$(date +%Y.%-m.%-d) | |
LAST_TAG=$(git describe --tags --abbrev=0) | |
if [[ "$LAST_TAG" == *"$DATE"* ]]; then | |
TAG_NUMBER=$(echo "$LAST_TAG" | awk -F. '{print $NF}') | |
TAG_NUMBER=$((TAG_NUMBER + 1)) | |
else | |
TAG_NUMBER=1 | |
fi | |
NEW_TAG="$DATE.${TAG_NUMBER}" | |
git tag "$NEW_TAG" | |
git push origin "$NEW_TAG" | |
poetry version "$NEW_TAG" | |
poetry build | |
- name: Upload to PyPI | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }} | |
run: poetry publish |