mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-05-20 16:28:15 +05:00
153 lines
3.4 KiB
YAML
153 lines
3.4 KiB
YAML
name: Build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
paths-ignore:
|
|
- "assets/**"
|
|
- "tools/**"
|
|
- "**/*.md"
|
|
- "LICENSE"
|
|
|
|
pull_request:
|
|
paths-ignore:
|
|
- "assets/**"
|
|
- "tools/**"
|
|
- "**/*.md"
|
|
- "LICENSE"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
prepare:
|
|
name: Prepare (get envs)
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
envs: ${{ steps.envs.outputs.envs }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "3.x"
|
|
|
|
- name: Install PlatformIO Core
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install --upgrade platformio
|
|
pip install --upgrade intelhex
|
|
|
|
- name: Get environments
|
|
id: envs
|
|
shell: bash
|
|
run: |
|
|
ENVS=$(
|
|
pio project config --json-output \
|
|
| jq -c '
|
|
.[]
|
|
| select(type == "array")
|
|
| .[0]
|
|
| select(startswith("env:"))
|
|
| sub("^env:"; "")
|
|
' | jq -s -c '.'
|
|
)
|
|
|
|
echo "envs=$ENVS" >> "$GITHUB_OUTPUT"
|
|
echo "$ENVS"
|
|
|
|
build:
|
|
name: Build ${{ matrix.env }}
|
|
runs-on: ubuntu-latest
|
|
needs: prepare
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
env: ${{ fromJson(needs.prepare.outputs.envs) }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "3.x"
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: "22"
|
|
|
|
- name: Install PlatformIO Core
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install --upgrade platformio
|
|
pip install --upgrade intelhex
|
|
|
|
- name: Full clean
|
|
run: |
|
|
pio run -e ${{ matrix.env }} -t fullclean
|
|
|
|
- name: Build firmware & filesystem
|
|
env:
|
|
PIOENV: ${{ matrix.env }}
|
|
run: |
|
|
pio run -e ${{ matrix.env }}
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: ${{ matrix.env }}
|
|
if-no-files-found: error
|
|
path: |
|
|
build/*.bin
|
|
build/*.elf
|
|
|
|
release:
|
|
name: Release Dev
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
permissions:
|
|
contents: write
|
|
if: ${{ github.repository_owner == 'Laxilef' && github.ref == 'refs/heads/async' }}
|
|
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
path: artifacts
|
|
merge-multiple: true
|
|
|
|
- name: Delete old release assets
|
|
uses: mknejp/delete-release-assets@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
tag: dev
|
|
fail-if-no-assets: false
|
|
fail-if-no-release: false
|
|
assets: |
|
|
*.bin
|
|
*.elf
|
|
|
|
- name: Publish Dev release
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
tag_name: dev
|
|
target_commitish: async
|
|
name: Dev (unstable)
|
|
prerelease: true
|
|
make_latest: false
|
|
generate_release_notes: true
|
|
files: |
|
|
artifacts/*.bin
|
|
artifacts/*.elf
|