Merge pull request #4 from bmorcelli/main #18
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-build | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
# - feature/cicd-adjusts | |
jobs: | |
build_and_release: | |
name: Build for tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: pip install requests esptool | |
- name: Install PlatformIO Core | |
run: | | |
pip install platformio | |
platformio update | |
- name: Build Project | |
run: | | |
platformio run | |
- name: Merge output binaries files | |
run: | | |
esptool.py --chip esp32 merge_bin -o .pio/build/m5stack-cplus1_1/release.bin --flash_mode dio --flash_size 4MB 0x1000 .pio/build/m5stack-cplus1_1/bootloader.bin 0x8000 .pio/build/m5stack-cplus1_1/partitions.bin 0x10000 .pio/build/m5stack-cplus1_1/firmware.bin | |
esptool.py --chip esp32 merge_bin -o .pio/build/m5stack-cplus2/release.bin --flash_mode dio --flash_size 8MB 0x1000 .pio/build/m5stack-cplus2/bootloader.bin 0x8000 .pio/build/m5stack-cplus2/partitions.bin 0x10000 .pio/build/m5stack-cplus2/firmware.bin | |
esptool.py --chip esp32s3 merge_bin -o .pio/build/m5stack-cardputer/release.bin --flash_mode dio --flash_size 8MB 0x0000 .pio/build/m5stack-cardputer/bootloader.bin 0x8000 .pio/build/m5stack-cardputer/partitions.bin 0x10000 .pio/build/m5stack-cardputer/firmware.bin | |
- name: Rename release.bin files | |
run: | | |
for file in $(find .pio/build/**/ -name 'release.bin'); do | |
version=$(echo ${{ github.run_number }}) | |
env=$(basename $(dirname "$file")) | |
new_name="Bruce_${env}_v0.0.$version.bin" | |
mv "$file" "$(dirname "$file")/$new_name" | |
done | |
chmod +r .pio/build/**/Bruce*.bin | |
ls .pio/build/**/Bruce*.bin | |
if: github.event_name != 'pull_request' | |
- name: Upload Binaries | |
id: upload_binaries_Cplus | |
uses: actions/upload-artifact@v3 | |
with: | |
path: .pio/build/m5stack-cplus1_1/Bruce*.bin | |
if: github.event_name != 'pull_request' | |
- name: Upload Binaries | |
id: upload_binaries_Cplus2 | |
uses: actions/upload-artifact@v3 | |
with: | |
path: .pio/build/m5stack-cplus2/Bruce*.bin | |
if: github.event_name != 'pull_request' | |
- name: Upload Binaries_Card | |
id: upload_binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
path: .pio/build/m5stack-cardputer/Bruce*.bin | |
if: github.event_name != 'pull_request' | |
#- name: Create Release | |
# id: create_release | |
# uses: actions/create-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.RELEASES_TOKEN }} | |
# with: | |
# tag_name: v0.0.${{ github.run_number }} | |
# release_name: v0.0.${{ github.run_number }} | |
# draft: true | |
# prerelease: false | |
# body: | | |
# Release automatically generated by CI/CD workflow. | |
# if: github.event_name != 'pull_request' | |
#- name: Upload Binaries Release Assets | |
# run: | | |
# for file in $(find .pio/build/** -name 'ESP_Web2Sd-Mgr*.bin'); do | |
# echo "Uploading $file" | |
# curl \ | |
# -X POST \ | |
# --data-binary @"$file" \ | |
# -H "Authorization: Bearer ${{ secrets.RELEASES_TOKEN }}" \ | |
# -H "Content-Type: application/octet-stream" \ | |
# "${{ steps.create_release.outputs.upload_url }}=$(basename $file)" | |
# done |