Cron Deploy #497
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: | |
# This input can be a comma-separated list of strings (e.g. "release/v5.1,release/v5.3") or "all" to build all branches. | |
# For IDF versions before v5.1, "all" is not supported. Use a specific branch instead. | |
description: 'IDF branch to build (check workflow file for instructions on how to use this input)' | |
required: true | |
default: 'all' | |
target: | |
# This input can be a comma-separated list of strings (e.g. "esp32,esp32s2") or "all" to build all targets. | |
# For IDF versions before v5.1, "all" is not supported. Use a specific target list instead. | |
description: 'Target to build (check workflow file for instructions on how to use this input)' | |
required: true | |
default: 'all' | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
gen-matrix: | |
name: Generate matrix | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.gen-matrix.outputs.matrix }} | |
branches: ${{ steps.gen-matrix.outputs.branches }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate matrix | |
id: gen-matrix | |
run: | | |
bash ./tools/cron-gen-matrix.sh "${{ github.event.inputs.idf_branch }}" "${{ github.event.inputs.target }}" | |
build-libs: | |
name: Build with IDF ${{ matrix.idf_branch }} for ${{ matrix.target }} | |
runs-on: ubuntu-latest | |
needs: gen-matrix | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.gen-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check if result should be deployed | |
id: check | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN || secrets.GITHUB_TOKEN }} | |
IDF_BRANCH: ${{ matrix.idf_branch }} | |
run: | | |
git checkout ${{ env.IDF_BRANCH }} || echo "Using master branch" | |
bash ./tools/check-deploy-needed.sh | |
- name: Install dependencies | |
#if: env.libs_has_commit == '0' || env.ar_has_commit == '0' | |
run: bash ./tools/prepare-ci.sh | |
- name: Build | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN || secrets.GITHUB_TOKEN }} | |
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | |
IDF_BRANCH: ${{ matrix.idf_branch }} | |
TARGETS: ${{ matrix.target }} | |
#if: env.libs_has_commit == '0' || env.ar_has_commit == '0' | |
run: | | |
bash ./tools/cron.sh | |
- name: Upload build | |
if: failure() && (env.libs_has_commit == '0' || env.ar_has_commit == '0') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ env.libs_version }}-${{ matrix.target }} | |
path: build | |
- name: Upload library files | |
#if: env.libs_has_commit == '0' || env.ar_has_commit == '0' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libs-${{ env.libs_version }}-${{ matrix.target }} | |
path: dist | |
combine-artifacts: | |
name: Combine artifacts for IDF ${{ matrix.idf_branch }} | |
runs-on: ubuntu-latest | |
needs: [gen-matrix, build-libs] | |
strategy: | |
fail-fast: false | |
matrix: | |
idf_branch: ${{ fromJson(needs.gen-matrix.outputs.branches) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check if result should be deployed | |
id: check | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN || secrets.GITHUB_TOKEN }} | |
IDF_BRANCH: ${{ matrix.idf_branch }} | |
run: | | |
git checkout ${{ env.IDF_BRANCH }} || echo "Using master branch" | |
bash ./tools/check-deploy-needed.sh | |
- name: Download artifacts | |
#if: env.libs_has_commit == '0' || env.ar_has_commit == '0' | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
pattern: libs-${{ env.libs_version }}-* | |
merge-multiple: true | |
- name: Combine artifacts | |
#if: env.libs_has_commit == '0' || env.ar_has_commit == '0' | |
run: | | |
bash ./tools/cron-combine.sh | |
- name: Upload full esp32-arduino-libs archive | |
#if: env.libs_has_commit == '0' || env.ar_has_commit == '0' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: esp32-arduino-libs | |
path: dist/esp32-arduino-libs.tar.gz | |
- name: Upload package_esp32_index.template.json | |
#if: env.libs_has_commit == '0' || env.ar_has_commit == '0' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: package-esp32-index-json | |
path: dist/package_esp32_index.template.json | |
- name: Push changes | |
if: github.repository == 'espressif/esp32-arduino-lib-builder' && (env.libs_has_commit == '0' || env.ar_has_commit == '0') | |
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/push-to-arduino.sh |