123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- # This is a basic workflow to help you get started with Actions
- name: ESP-IDF v4.3.1
- on:
- push:
- branches:
- - '**4.3'
- pull_request:
- branches:
- - '**4.3'
- jobs:
- job1:
- name: Build Number
- runs-on: ubuntu-latest
- outputs:
- build_number: ${{ steps.buildnumber.outputs.build_number }}
- steps:
- - name: Generate common build number
- id: buildnumber
- uses: einaregilsson/build-number@v3
- with:
- token: ${{secrets.github_token}}
- build:
- runs-on: ubuntu-latest
- needs: job1
- strategy:
- max-parallel: 1
- matrix:
- node: [I2S-4MFlash, SqueezeAmp, Muse]
- depth: [16, 32]
- exclude:
- - node: Muse
- depth: 32
- steps:
- - name: Set target name
- run: |
- echo "TARGET_BUILD_NAME=${{ matrix.node }}" >> $GITHUB_ENV
- echo "build_version_prefix=2." >> $GITHUB_ENV
- - uses: actions/checkout@v2
- with:
- fetch-depth: 15
- submodules: true
- - name: Cache build
- id: cache-build
- uses: actions/cache@v2
- with:
- path: |
- ~/build
- ./
- key: ${{ runner.os }}-${{ matrix.node }}
- - name: Set build parameters
- run: |
- git update-index --chmod=+x ./server_certs/getcert.sh
- git update-index --chmod=+x ./buildFirmware.sh
- git update-index --chmod=+x ./components/spotify/cspot/bell/nanopb/generator/protoc
- git update-index --chmod=+x ./components/spotify/cspot/bell/nanopb/generator/protoc-gen-nanopb
- git update-index --chmod=+x ./components/spotify/cspot/bell/nanopb/generator/*.py
- git update-index --chmod=+x ./components/spotify/cspot/bell/nanopb/generator/*.py2
- git update-index --chmod=+x ./components/spotify/cspot/bell/nanopb/generator/proto/*.py
-
- cd server_certs;./getcert.sh;cat github.pem;cd ..
- shopt -s nocasematch
- branch_name="${GITHUB_REF//refs\/heads\//}"
- branch_name="${branch_name//[^a-zA-Z0-9\-~!@_\.]/}"
- BUILD_NUMBER=${{ needs.job1.outputs.build_number }}
- echo "BUILD_NUMBER=${BUILD_NUMBER}" >> $GITHUB_ENV
- echo "DOCKER_IMAGE_NAME=sle118/squeezelite-esp32-idfv4-master" >> $GITHUB_ENV
- tag="${TARGET_BUILD_NAME}.${{matrix.depth}}.${build_version_prefix}${BUILD_NUMBER}.${branch_name}"
- echo "tag=${tag}" >> $GITHUB_ENV
- last_commit="$(git log --pretty=format:'%s' --max-count=1)"
- if [[ "$last_commit" =~ .*"Release".* ]]; then echo "release_flag=1" >> $GITHUB_ENV; else echo "release_flag=0" >> $GITHUB_ENV; fi
- name="${build_version_prefix}${BUILD_NUMBER}-${{matrix.depth}}#v4.0#${TARGET_BUILD_NAME}#${branch_name}"
- artifact_prefix="squeezelite-esp32-${branch_name}-${TARGET_BUILD_NAME}-${{matrix.depth}}-${build_version_prefix}${BUILD_NUMBER}"
- artifact_file_name="${artifact_prefix}.zip"
- artifact_bin_file_name="${artifact_prefix}.bin"
- echo "name=${name}" >> $GITHUB_ENV
- echo "last_commit=${last_commit}" >> $GITHUB_ENV
- echo "artifact_file_name=${artifact_file_name}" >> $GITHUB_ENV
- echo "PROJECT_VER=${TARGET_BUILD_NAME}-${{ steps.buildnumber.outputs.build_number }} " >> $GITHUB_ENV
- echo "artifact_bin_file_name=${artifact_bin_file_name}" >> $GITHUB_ENV
- description=$'### Revision Log\n'
- githist="$(git log --pretty=format:'%h %s (%cI) <%an>' --abbrev-commit --max-count=15 | sed --r 's/(^[\*]+)/\\\1/g')"
- description="$description$githist"
- echo 'description<<~EOD' >> $GITHUB_ENV
- echo ${description}>> $GITHUB_ENV
- echo '~EOD' >> $GITHUB_ENV
- echo #######
- echo ####### Environment
- echo #######
- env
- echo #######
- echo ####### GITHUB ENV
- echo #######
- cat $GITHUB_ENV
- - name: Build the firmware
- run: |
- env | grep "artifact\|tag\|GITHUB\|version\|NUMBER\|TARGET" >${TARGET_BUILD_NAME}-env.txt
- echo pulling custom docker image ${DOCKER_IMAGE_NAME}
- docker pull ${DOCKER_IMAGE_NAME}
- docker run --env-file=${TARGET_BUILD_NAME}-env.txt -v $PWD:/project -w /project ${DOCKER_IMAGE_NAME} /bin/bash -c "./buildFirmware.sh"
- # - name: Build Mock firmware
- # run: |
- # mkdir -p build
- # cd build
- # mkdir -p partition_table
- # mkdir -p bootloader
- # echo "mock content"> squeezelite.bin
- # echo "mock content"> recovery.bin
- # echo "mock content"> ./bootloader/bootloader.bin
- # echo "mock content"> ./partition_table/partition-table.bin
- # echo "mock content"> flash_project_args
- # echo "mock content"> size_comp1.txt
- # echo "mock content"> size_comp2.txt
- # echo "mock content"> ../partitions.csv
- - uses: actions/upload-artifact@v2
- with:
- name: ${{ env.artifact_file_name }}
- path: |
- build/*.bin
- build/bootloader/bootloader.bin
- build/partition_table/partition-table.bin
- build/flash_project_args
- build/size_comp1.txt
- build/size_comp2.txt
- partitions.csv
- sdkconfig
- server_certs/github.pem
- build_output.zip
- - uses: actions/upload-artifact@v2
- with:
- name: ${{ env.artifact_bin_file_name }}
- path: |
- build/squeezelite.bin
- - name: Create Release
- if: env.release_flag == 1
- id: create_release
- uses: actions/create-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
- with:
- tag_name: ${{ env.tag }}
- release_name: ${{ env.name }}
- body: ${{ env.description }}
- draft: false
- prerelease: true
- - name: Upload Release Asset - Squeezelite binary file
- if: env.release_flag == 1
- id: upload-release-asset
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
- asset_path: build/squeezelite.bin
- asset_name: ${{ env.artifact_bin_file_name }}
- asset_content_type: application/octet-stream
- - name: Upload Release Asset - Zip file
- if: env.release_flag == 1
- id: upload-release-asset-zip
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
- asset_path: build/${{ env.artifact_file_name }}
- asset_name: ${{ env.artifact_file_name }}
- asset_content_type: application/octet-stream
|