Try windows #26
Workflow file for this run
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: Test and Release | |
on: | |
push: | |
branches: | |
- main | |
- test_windows | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install PlatformIO | |
run: | | |
python -m pip install --upgrade pip | |
pip install platformio | |
- name: Run heltec_wifi_kit_32_V3 | |
run: platformio run -e heltec_wifi_kit_32_V3 -d ./examples/example1/ | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install PlatformIO | |
run: | | |
python -m pip install --upgrade pip | |
pip install platformio | |
- name: Run tests on the native platform | |
run: platformio test -e stable -d ./examples/example1/ | |
release: | |
needs: | |
- build | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set Up Git | |
run: | | |
git config --global user.name "${{ vars.USER_NAME }}" | |
git config --global user.email "${{ vars.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=latest_version::$latest_version" | |
echo "::set-output name=version::$next_version" | |
echo "::set-output name=version_noversion::$next_version_no_v" | |
- name: Update Version in File | |
run: | | |
sed -i 's/\(mauro-midolo\/ESP32 Heltec OLED Logger@^\)[0-9.]\+/\1'"${{ steps.get_version.outputs.version_noversion }}"'/' ./examples/example1/platformio.ini | |
python -c "import json; data = json.load(open('library.json')); data['version'] = '${{ steps.get_version.outputs.version_noversion }}'; json.dump(data, open('library.json', 'w'))" | |
- name: Commit Changes | |
run: | | |
git add ./examples/example1/platformio.ini library.json | |
git commit -m "Upgrade version from ${{ steps.get_version.outputs.latest_version }} to ${{ steps.get_version.outputs.version }}" | |
git push origin main | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ steps.get_version.outputs.version }} | |
release_name: ${{ steps.get_version.outputs.version }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install PlatformIO | |
run: | | |
python -m pip install --upgrade pip | |
pip install platformio | |
- name: Release into PlatformIO | |
run: | | |
pio pkg publish --no-interactive | |
env: | |
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} | |