# STEPS FOR BUILDING AND RELEASING NEW VERSION

## IN POWERSHELL (SHORTER):
- Assuming you are on main-branch and you still need to create release/vX.X.X branch:
1. run ./docs/release.ps1 -> specify version when asked from script prompt. result -> created binaries in /dist with specified version.
2. run ./docs/upload.ps1 -> upload wheels in /dist folder to pypi. assumes pypi-token is in .env
3. run ./docs/merge-branch.ps1 -> merge release-branch with main

## AS SEPERATE STEPS:
0. git checkout -b release/vX.X.X
1. Run all tests locally with: pytest -vvv and for linux with different py versions with: docker\run_tests.ps1
2. Update the README.md in the working directory by running src/owlsight/docs/readme.py
3. Commit changes: git commit -am "Update version to X.X.X"
4. Add a git tag by command: git tag -a vX.X.X -m "New release version X.X.X"
5. Push the changes and tags to the repository: git push && git push --tags
6. Build the distribution packages: python -m build
7. Upload the package to PyPI through CMD.exe:
    SET API_TOKEN=... // get api-token from pypi
    twine check dist/*
    twine upload -u __token__ -p %API_TOKEN% dist/* --verbose
8. If all went well, merge the relasebranch with the mainbranch:
    git checkout main
    git merge release/vX.X.X
    git push

# TROUBLESHOOTING

I want to replace the latest git tag:
1. find last tag
git tag 
2. delete last tag
git tag -d <tag_name>
3. push changes
git push origin --delete <tag_name>