Bump actions/cache from 3 to 4 (#45) #39
This file contains hidden or 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: HyperSerialEsp8266 CI Build | |
| on: [push] | |
| jobs: | |
| ###################### | |
| #### PlatformIO ###### | |
| ###################### | |
| PlatformIO: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/[email protected] | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.platformio | |
| key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| - name: Install PlatformIO | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --upgrade platformio | |
| - name: Run PlatformIO | |
| run: pio run | |
| - uses: actions/[email protected] | |
| name: Upload artifacts (commit) | |
| if: (startsWith(github.event.ref, 'refs/tags') != true) | |
| with: | |
| path: | | |
| .pio/build/*.bin | |
| - uses: actions/[email protected] | |
| name: Upload artifacts (release) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| name: release-artifact | |
| path: | | |
| .pio/build/*.bin | |
| ################################ | |
| ###### Publish Releases ######## | |
| ################################ | |
| publish: | |
| name: Publish Releases | |
| if: startsWith(github.event.ref, 'refs/tags') | |
| needs: [PlatformIO] | |
| runs-on: ubuntu-latest | |
| steps: | |
| # generate environment variables | |
| - name: Generate environment variables from version and tag | |
| run: | | |
| echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| echo "preRelease=false" >> $GITHUB_ENV | |
| # If version contains alpha or beta, mark draft release as pre-release | |
| - name: Mark release as pre-release | |
| if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') | |
| run: echo "preRelease=true" >> $GITHUB_ENV | |
| - uses: actions/[email protected] | |
| with: | |
| path: artifacts | |
| pattern: release-artifact | |
| merge-multiple: true | |
| # create draft release and upload artifacts | |
| - name: Create draft release | |
| uses: softprops/[email protected] | |
| with: | |
| name: HyperSerialEsp8266 ${{ env.VERSION }} | |
| tag_name: ${{ env.TAG }} | |
| files: "artifacts/*.bin" | |
| draft: true | |
| prerelease: ${{ env.preRelease }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |