name: Create Release on: push: tags: - 'v*' permissions: contents: write # for creating releases and uploading assets discussions: write # if you want to allow release discussions packages: write # if you're publishing packages jobs: build: runs-on: ubuntu-latest # Add permissions at job level as well permissions: contents: write steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install PlatformIO run: | python -m pip install --upgrade pip pip install --upgrade platformio - name: Build Firmware run: | pio run -t buildfs # Build SPIFFS pio run # Build firmware - name: Install esptool run: | pip install esptool - name: Merge firmware and SPIFFS run: | esptool.py --chip esp32 merge_bin \ --flash_mode dio \ --flash_freq 40m \ --flash_size 4MB \ -o .pio/build/esp32dev/filaman.bin \ 0x10000 .pio/build/esp32dev/firmware.bin \ 0x290000 .pio/build/esp32dev/spiffs.bin - name: Get version from tag id: get_version run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - name: Read CHANGELOG.md id: changelog run: | CHANGELOG=$(awk "/## \\[${{ steps.get_version.outputs.VERSION }}\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md) echo "CHANGES<> $GITHUB_OUTPUT echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - name: Create Release and Upload Assets env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Create release gh release create ${{ github.ref_name }} \ --title "Release ${{ steps.get_version.outputs.VERSION }}" \ --notes "${{ steps.changelog.outputs.CHANGES }}" \ ".pio/build/esp32dev/filaman.bin#filaman-${{ steps.get_version.outputs.VERSION }}.bin" \ --draft false \ --prerelease false