Cron Deploy #443
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: Cron Build | |
on: | |
schedule: | |
# ┌───────────── minute (0 - 59) | |
# │ ┌───────────── hour (0 - 23) | |
# │ │ ┌───────────── day of the month (1 - 31) | |
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | |
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | |
# │ │ │ │ │ | |
# │ │ │ │ │ | |
# │ │ │ │ │ | |
# * * * * * | |
- cron: '0 */6 * * *' | |
workflow_dispatch: | |
inputs: | |
idf_branch: | |
description: 'IDF branch to build' | |
required: true | |
default: 'release/v5.1' | |
target: | |
description: 'Target to build' | |
required: true | |
default: 'all' | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-libs: | |
name: Build with IDF ${{ matrix.idf_branch }} for ${{ matrix.target }} | |
runs-on: ubuntu-latest | |
if: github.event_name == 'schedule' | |
strategy: | |
fail-fast: false | |
matrix: | |
idf_branch: [release/v5.1, release/v4.4] #, release/v3.3] | |
target: [esp32, esp32s2, esp32s3, esp32c3] | |
include: | |
- idf_branch: release/v5.1 | |
target: esp32c2 | |
- idf_branch: release/v5.1 | |
target: esp32c6 | |
- idf_branch: release/v5.1 | |
target: esp32h2 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: bash ./tools/prepare-ci.sh | |
- name: Build | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | |
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
IDF_BRANCH: ${{ matrix.idf_branch }} | |
run: | | |
git checkout ${{ env.IDF_BRANCH }} || echo "Using master branch" | |
if [ ! "$GITHUB_EVENT_NAME" == "schedule" ]; then | |
echo "Wrong event '$GITHUB_EVENT_NAME'!" | |
exit 1 | |
fi | |
bash ./build.sh -e -t ${{ matrix.target }} | |
- name: Upload build | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.idf_branch }}-${{ matrix.target }} | |
path: build | |
- name: Upload library files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libs-${{ matrix.idf_branch }}-${{ matrix.target }} | |
path: dist | |
combine-artifacts: | |
name: Combine artifacts for IDF ${{ matrix.idf_branch }} | |
runs-on: ubuntu-latest | |
if: github.event_name == 'schedule' | |
needs: build-libs | |
strategy: | |
fail-fast: false | |
matrix: | |
idf_branch: [release/v5.1, release/v4.4] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
pattern: libs-${{ matrix.idf_branch }}-* | |
merge-multiple: true | |
- name: Combine artifacts | |
shell: bash | |
run: | | |
set -e | |
mkdir -p out | |
find dist -name 'arduino-esp32-libs-esp*.tar.gz' -exec tar zxvf {} -C out \; | |
for file in $files; do | |
tar zxvf $file -C out | |
cat out/tools/esp32-arduino-libs/versions.txt >> out/tools/esp32-arduino-libs/versions_full.txt | |
done | |
awk -i inplace '!seen[$0]++' out/tools/esp32-arduino-libs/versions_full.txt | |
mv -f out/tools/esp32-arduino-libs/versions_full.txt out/tools/esp32-arduino-libs/versions.txt | |
cd out/tools/esp32-arduino-libs && tar zcf ../../../dist/esp32-arduino-libs.tar.gz * && cd ../../.. | |
cp out/package_esp32_index.template.json dist/package_esp32_index.template.json | |
- name: Push changes | |
if: ${{ github.repository == 'espressif/esp32-arduino-lib-builder' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | |
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
IDF_BRANCH: ${{ matrix.idf_branch }} | |
run: | | |
./tools/push-to-arduino.sh | |
if [ $? -ne 0 ]; then exit 1; fi | |
build-libs-dispatch: | |
name: Dispatch build with IDF ${{ inputs.idf_branch }} | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: bash ./tools/prepare-ci.sh | |
- name: Build | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | |
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
IDF_BRANCH: ${{ inputs.idf_branch }} | |
run: | | |
git checkout ${{ env.IDF_BRANCH }} || echo "Using master branch" | |
if [ ! "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then | |
echo "Wrong event '$GITHUB_EVENT_NAME'!" | |
exit 1 | |
fi | |
bash ./build.sh -d -t ${{ inputs.target }} | |
- name: Upload build | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: build | |
- name: Upload archive | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: dist | |
# check: | |
# name: Check if result should be deployed | |
# runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# branch: [release/v5.1, release/v4.4] #, release/v3.3] | |
# outputs: | |
# idf_branch: ${{ steps.check.outputs.idf_branch }} | |
# idf_commit: ${{ steps.check.outputs.idf_commit }} | |
# ar_branch: ${{ steps.check.outputs.ar_branch }} | |
# ar_new_commit_message: ${{ steps.check.outputs.ar_new_commit_message }} | |
# ar_new_branch_name: ${{ steps.check.outputs.ar_new_branch_name }} | |
# ar_new_pr_title: ${{ steps.check.outputs.ar_new_pr_title }} | |
# ar_has_commit: ${{ steps.check.outputs.ar_has_commit }} | |
# ar_has_branch: ${{ steps.check.outputs.ar_has_branch }} | |
# ar_has_pr: ${{ steps.check.outputs.ar_has_pr }} | |
# libs_version: ${{ steps.check.outputs.libs_version }} | |
# libs_has_commit: ${{ steps.check.outputs.libs_has_commit }} | |
# libs_has_branch: ${{ steps.check.outputs.libs_has_branch }} | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - id: check | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | |
# GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
# GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
# IDF_BRANCH: ${{ matrix.idf_branch }} | |
# run: bash ./tools/check-deploy-needed.sh | |
# build: | |
# name: Build Libs for ${{ matrix.target }} | |
# runs-on: ubuntu-latest | |
# needs: check | |
# if: needs.check.outputs.libs_has_commit == '0' || needs.check.outputs.ar_has_commit == '0' | |
# strategy: | |
# matrix: | |
# target: [esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2] | |
# fail-fast: false | |
# steps: | |
# - uses: actions/checkout@v3 | |
# # - name: Install dependencies | |
# # run: bash ./tools/prepare-ci.sh | |
# - shell: bash | |
# name: Build Libs for ${{ matrix.target }} | |
# run: echo ${{ matrix.target }} | |
# # run: bash ./build.sh -t ${{ matrix.target }} | |
# # - name: Upload archive | |
# # uses: actions/upload-artifact@v3 | |
# # with: | |
# # name: artifacts | |
# # path: dist | |
# deploy: | |
# name: Deploy build | |
# runs-on: ubuntu-latest | |
# needs: [check, build] | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - shell: bash | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | |
# GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
# GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
# IDF_BRANCH: ${{ needs.check.outputs.idf_branch }} | |
# IDF_COMMIT: ${{ needs.check.outputs.idf_commit }} | |
# AR_BRANCH: ${{ needs.check.outputs.ar_branch }} | |
# AR_NEW_COMMIT_MESSAGE: ${{ needs.check.outputs.ar_new_commit_message }} | |
# AR_NEW_BRANCH_NAME: ${{ needs.check.outputs.ar_new_branch_name }} | |
# AR_NEW_PR_TITLE: ${{ needs.check.outputs.ar_new_pr_title }} | |
# AR_HAS_COMMIT: ${{ needs.check.outputs.ar_has_commit }} | |
# AR_HAS_BRANCH: ${{ needs.check.outputs.ar_has_branch }} | |
# AR_HAS_PR: ${{ needs.check.outputs.ar_has_pr }} | |
# LIBS_VERSION: ${{ needs.check.outputs.libs_version }} | |
# LIBS_HAS_COMMIT: ${{ needs.check.outputs.libs_has_commit }} | |
# LIBS_HAS_BRANCH: ${{ needs.check.outputs.libs_has_branch }} | |
# run: | | |
# echo "IDF_COMMIT: $IDF_COMMIT" | |
# echo "AR_BRANCH: $AR_BRANCH" | |
# echo "AR_NEW_COMMIT_MESSAGE: $AR_NEW_COMMIT_MESSAGE" | |
# echo "AR_NEW_BRANCH_NAME: $AR_NEW_BRANCH_NAME" | |
# echo "AR_NEW_PR_TITLE: $AR_NEW_PR_TITLE" | |
# echo "AR_HAS_COMMIT: $AR_HAS_COMMIT" | |
# echo "AR_HAS_BRANCH: $AR_HAS_BRANCH" | |
# echo "AR_HAS_PR: $AR_HAS_PR" | |
# echo "LIBS_VERSION: $LIBS_VERSION" | |
# echo "LIBS_HAS_COMMIT: $LIBS_HAS_COMMIT" | |
# echo "LIBS_HAS_BRANCH: $LIBS_HAS_BRANCH" | |