ci(github): Run build and check when opening pull requests #28
Workflow file for this run
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: Build and release | |
on: [push, pull_request] | |
jobs: | |
build_stubs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ref commit | |
uses: actions/checkout@master | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install esptool | |
- name: Build stub | |
run: | | |
export TOOLCHAIN_DIR=$HOME/toolchain | |
export ESP8266_BINDIR=$TOOLCHAIN_DIR/xtensa-lx106-elf/bin | |
export ESP32_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32-elf/bin | |
export ESP32S2_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32s2-elf/bin | |
export ESP32S3_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32s3-elf/bin | |
export ESP32C3_BINDIR=$TOOLCHAIN_DIR/riscv32-esp-elf/bin | |
export PATH=$PATH:$ESP8266_BINDIR:$ESP32_BINDIR:$ESP32S2_BINDIR:$ESP32S3_BINDIR:$ESP32C3_BINDIR | |
./ci/setup_ci_build_env.sh | |
make -C flasher_stub V=1 | |
- name: Upload stub JSONs | |
uses: actions/upload-artifact@v4 | |
with: | |
path: flasher_stub/build/esp*.json | |
if-no-files-found: error | |
retention-days: 3 | |
create_release: | |
name: Create GitHub release | |
needs: build_stubs | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Get version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --user commitizen | |
- name: Generate changelog | |
run: | | |
cz changelog ${{ steps.get_version.outputs.VERSION }} --template ci/gh_changelog_template.md.j2 --file-name changelog_body.md | |
cat changelog_body.md | |
- name: Download stub JSONs | |
uses: actions/download-artifact@v4 | |
- name: Create release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
body_path: changelog_body.md | |
name: Version ${{ steps.get_version.outputs.VERSION }} | |
draft: true | |
prerelease: false | |
fail_on_unmatched_files: true | |
files: artifact/esp*.json |