fetch tags then get latest commit tag #21
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: release | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*.*.*' | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
DEST_FOLDER: dist/ | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
# https://stackoverflow.com/questions/66349002/get-latest-tag-git-describe-tags-when-repo-is-cloned-with-depth-1 | |
- name: Get latest tag | |
run: | | |
git fetch -a | |
echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT | |
- name: Install py39 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
cache: pip | |
cache-dependency-path: 'requirements/*.pip' | |
- name: build | |
shell: bash | |
env: | |
RELEASE_VERSION: ${{ steps.vars.outputs.tag }} | |
run: | | |
python -m pip install --upgrade -r requirements/pip-tools.pip | |
echo "python igor.py build_next $RELEASE_VERSION" | |
python igor.py build_next "$RELEASE_VERSION" | |
- name: Release PyPI | |
shell: bash | |
env: | |
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
pip install --upgrade twine | |
twine upload ${{ env.DEST_FOLDER }}* | |
- name: Release GitHub | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ env.DEST_FOLDER }}* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |