blackmagic-esp32-s2/.github/workflows/build.yml

106 lines
3.3 KiB
YAML
Raw Permalink Normal View History

2021-11-22 17:12:50 +00:00
name: 'Build'
on:
2021-11-22 17:12:50 +00:00
push:
branches:
- dev
- "release*"
tags:
- '*'
pull_request:
jobs:
build:
runs-on: ubuntu-22.04
2021-11-22 17:12:50 +00:00
steps:
- name: 'Store UID'
2021-11-22 17:12:50 +00:00
id: uid
run: |
echo id="$(id -u $USER)" >> $GITHUB_OUTPUT
2021-11-22 17:12:50 +00:00
- name: 'Wipe workspace'
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
2021-11-22 17:12:50 +00:00
- name: 'Checkout code'
uses: actions/checkout@v3
2021-11-22 17:12:50 +00:00
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: 'Setup python'
uses: actions/setup-python@v4
with:
python-version: '3.11'
2021-11-22 17:12:50 +00:00
- name: 'Get commit details'
2021-11-22 17:12:50 +00:00
id: names
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
TYPE="pull"
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
TYPE="tag"
2021-11-22 17:12:50 +00:00
else
TYPE="other"
2021-11-22 17:12:50 +00:00
fi
python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE"
echo "event_type=$TYPE" >> $GITHUB_OUTPUT
2021-11-22 17:12:50 +00:00
- name: 'Setup node'
uses: actions/setup-node@v3
2021-11-22 17:12:50 +00:00
with:
node-version: '17'
cache: 'npm'
cache-dependency-path: components/svelte-portal
- name: 'Install node dependencies'
2021-11-22 17:12:50 +00:00
run: npm install
working-directory: components/svelte-portal
- name: 'Build captive portal'
2021-11-22 17:12:50 +00:00
run: npm run build
working-directory: components/svelte-portal
- name: 'Build firmware'
2021-12-02 14:20:01 +00:00
uses: Intake-Health/esp-idf-ci-action@release-v4.4
2021-11-22 17:12:50 +00:00
- name: 'Fix ownership'
2021-11-22 17:12:50 +00:00
uses: peter-murray/reset-workspace-ownership-action@v1
with:
user_id: ${{ steps.uid.outputs.id }}
- name: 'Make artifacts directory'
2021-11-22 17:12:50 +00:00
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
rm -rf artifacts
2021-11-22 17:12:50 +00:00
mkdir artifacts
- name: 'Move upload files'
2021-11-22 17:12:50 +00:00
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
mv build/bootloader/bootloader.bin artifacts/
mv build/partition_table/partition-table.bin artifacts/
mv build/blackmagic.bin artifacts/
2021-11-25 12:29:06 +00:00
cp scripts/flash_nix.sh artifacts/
2021-11-22 17:12:50 +00:00
- name: 'Generate flash.command file'
2021-11-22 17:12:50 +00:00
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
echo "esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip esp32s2 write_flash $(tr '\n' ' ' < build/flash_args)" > artifacts/flash.command
2021-11-22 17:12:50 +00:00
sed -i 's/partition_table\///g' artifacts/flash.command
sed -i 's/bootloader\///g' artifacts/flash.command
- name: 'Generate archive'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
mkdir -p "artifacts-archive"
2023-04-28 13:05:57 +01:00
tar -czvf artifacts-archive/blackmagic-firmware-s2-full-${SUFFIX}.tgz -C artifacts/ .
- name: 'Upload artifacts to update server'
2021-11-22 17:12:50 +00:00
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
FILES=$(for CUR in $(ls artifacts-archive/); do echo "-F files=@artifacts-archive/$CUR"; done)
curl --fail -L -H "Token: ${{ secrets.INDEXER_TOKEN }}" \
-F "branch=${BRANCH_NAME}" \
${FILES[@]} \
"${{ secrets.INDEXER_UPLOAD_URL }}"