patch #1
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
# Links | |
# ----------------------------------------------------------------------------- | |
# | |
# Push from pipeline: https://stackoverflow.com/questions/57921401/push-to-origin-from-github-action | |
# How somone else did this: https://www.seanh.cc/2022/05/21/publishing-python-packages-from-github-actions/ | |
# | |
# How to handle release/v1 and release/v2? | |
name: patch | |
on: | |
workflow_dispatch: | |
jobs: | |
patch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Dependencies. | |
run: | | |
init_version=$( python3 -m yaml_settings_pydantic version ) | |
python3 -m pip install bumpver | |
- name: Bump Version. | |
run: python3 -m bumpver | |
- name: Commit and Push. | |
run: | | |
git config --global user.name 'Github Actions' | |
git config --global user.email '[email protected]' | |
git remote set-url origin 'https://x-access-token:${{ secrets.PYS_GITHUB_ACCESS_TOKEN }}@github.com/${{ github.repository }}' | |
git push | |
git push --tags | |
- name: Trigger the Pipeline for Publishing (See key 'on' of publish). | |
run: | | |
final_version=$( python3 -m yaml_settings_pydantic version ) | |
if [[ $init_version == $final_version ]]; | |
then | |
echo " | |
Failed to bump version. Initial version ($init_version) matches | |
version after bumping ($final_version). | |
" | |
fi | |
gh release create \ | |
--repo '${{ github.repository }}' \ | |
--title "$final_version" \ | |
--notes "Release $final_version. Bumped from $init_version -> $final_version." |