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: Aggiorna Versione, Commit e Rilascio | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set Up Git | |
run: | | |
git config user.name "${{ env.USER_NAME }}" | |
git config user.email "${{ env.USER_EMAIL }}" | |
- name: Get Latest Release Version | |
id: get_version | |
run: | | |
latest_version=$(curl -s https://api.github.com/repos/mauro-midolo/ESP32-heltec-oled-logger/releases/latest | jq -r .tag_name) | |
echo "Latest Version: $latest_version" | |
next_version=$(python -c "parts = '$latest_version'.split('.'); parts[-1] = str(int(parts[-1]) + 1); print('.'.join(parts))") | |
next_version_no_v=$(python -c "parts = '$latest_version'.split('.'); parts[-1] = str(int(parts[-1]) + 1); print('.'.join(parts).replace('v',''))") | |
echo "Next Version: $next_version" | |
echo "Next Version no version: $next_version_no_v" | |
echo "::set-output name=version::$next_version" | |
echo "::set-output name=version_noversion::$next_version_no_v" | |
- name: Update Version in File | |
run: | | |
python -c "import json; data = json.load(open('path/to/your/library.json')); data['version'] = '$next_version'; json.dump(data, open('path/to/your/library.json', 'w'))" |