Update Publish.yaml #13
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: Build and Release PlatformIO Project | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
board: [esp32_s2, esp32_wroom, esp32_c3] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install PlatformIO | |
run: pip install platformio | |
- name: Build with PlatformIO | |
run: platformio run --environment ${{ matrix.board }} | |
- name: Tar artifacts | |
run: tar -czvf ${{ matrix.board }}.tar.gz -C .pio/build/${{ matrix.board }} firmware.bin partitions.bin bootloader.bin | |
- name: Fetch all tags | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Calculate new tag name | |
id: new_tag | |
run: | | |
highest_tag=$(git tag -l 'release-*' | sort -V | tail -n1) | |
highest_num=${highest_tag##*-} | |
new_num=$((highest_num + 1)) | |
echo "New tag will be release-$new_num" | |
echo "::set-output name=tag::release-$new_num" | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
./${{ matrix.board }}.tar.gz | |
tag_name: ${{ steps.new_tag.outputs.tag }} | |
name: ${{ steps.new_tag.outputs.tag }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |