Skip to content

Commit

Permalink
Build upon upstream change
Browse files Browse the repository at this point in the history
  • Loading branch information
vidplace7 committed Oct 7, 2024
1 parent c63d586 commit 93767e4
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 37 deletions.
124 changes: 87 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
name: CI
name: Build
on:
# # Triggers the workflow on push but only for the master branch
push:
branches: [main, testing]
paths-ignore:
- "**.md"
- version.properties

# Note: This is different from "pull_request". Need to specify ref when doing checkouts.
pull_request_target:
branches: [master, testing]
paths-ignore:
- "**.md"
#- "**.yml"
# push:
# branches: [main, testing]
# paths-ignore:
# - "**.md"
# - version.properties

# # Note: This is different from "pull_request". Need to specify ref when doing checkouts.
# pull_request_target:
# branches: [master, testing]
# paths-ignore:
# - "**.md"
# #- "**.yml"

schedule:
- cron: '0 23 * * *' # Nightly master build

workflow_dispatch:
inputs:
meshtastic_firmware_ref:
description: Meshtastic firmware ref
required: true
type: string
default: master

workflow_call:
inputs:
meshtastic_firmware_ref:
description: Meshtastic firmware ref
required: true
type: string
default: master

env:
meshtastic_firmware_ref: ${{ inputs.meshtastic_firmware_ref || 'master' }}

jobs:
build:
Expand All @@ -23,21 +43,6 @@ jobs:
fail-fast: false
matrix:
include:
- arch: esp32s3
board: t-energy-s3_e22
remove-debug-flags: >-
./arch/esp32/esp32.ini
./arch/esp32/esp32s2.ini
./arch/esp32/esp32s3.ini
./arch/esp32/esp32c3.ini
build-script-path: bin/build-esp32.sh
ota-firmware-source: firmware-s3.bin
ota-firmware-target: release/bleota-s3.bin
artifact-paths: |
release/*.bin
release/*.elf
include-web-ui: true

- arch: nrf52840
board: xiao_ble
build-script-path: bin/build-nrf52.sh
Expand All @@ -46,22 +51,39 @@ jobs:
release/*.uf2
release/*.elf
release/*.zip
- arch: rp2040
board: rp2040-lora-slowclock
build-script-path: bin/build-rpi2040.sh
artifact-paths: |
release/*.uf2
release/*.elf
runs-on: ubuntu-latest
# - arch: esp32s3
# board: t-energy-s3_e22
# remove-debug-flags: >-
# ./arch/esp32/esp32.ini
# ./arch/esp32/esp32s2.ini
# ./arch/esp32/esp32s3.ini
# ./arch/esp32/esp32c3.ini
# build-script-path: bin/build-esp32.sh
# ota-firmware-source: firmware-s3.bin
# ota-firmware-target: release/bleota-s3.bin
# artifact-paths: |
# release/*.bin
# release/*.elf
# include-web-ui: true

# - arch: rp2040
# board: rp2040-lora-slowclock
# build-script-path: bin/build-rpi2040.sh
# artifact-paths: |
# release/*.uf2
# release/*.elf

runs-on: ubuntu-24.04
outputs:
version: ${{ steps.build.outputs.version }}
steps:
- id: checkout_firmware
name: Checkout Meshtastic firmware
uses: actions/checkout@v4
with:
repository: meshtastic/firmware
ref: master
ref: ${{ env.meshtastic_firmware_ref }}
submodules: recursive

- id: checkout_custom
Expand Down Expand Up @@ -103,3 +125,31 @@ jobs:
overwrite: true
path: |
${{ matrix.artifact-paths }}
release:
name: Release
if: (inputs.meshtastic_firmware_ref || 'master') != 'master'
runs-on: ubuntu-24.04
needs: build
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: "firmware-*-${{ needs.build.outputs.version }}.zip"
merge-multiple: true
path: ./release

- name: Create Release
uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: true
name: Meshtastic Firmware v${{ needs.build.outputs.version }}
tag_name: v${{ needs.build.outputs.version }}
body: |
Autogenerated by github action, developer should edit as required before publishing...
fail_on_unmatched_files: true
files: |
./release/firmware-*-${{ needs.build.outputs.version }}.zip
51 changes: 51 additions & 0 deletions .github/workflows/check_upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Check upstream releases
on:
schedule:
- cron: '0 0 * * *' # Nightly
workflow_dispatch: # Debugging
jobs:
check:
name: Check for meshtastic firmware changes
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

# Get the latest meshtastic releases
- id: gh_meshtastic_firmware_release
name: Get latest Meshtastic firmware releases
run: |
beta_json=$(curl -s ${{ github.api_url }}/repos/meshtastic/firmware/releases/latest | jq)
alpha_json=$(curl -s ${{ github.api_url }}/repos/meshtastic/firmware/releases | jq 'map(select(.prerelease)) | first')
echo "beta_ver=$(jq -r '.tag_name' <<< $beta_json)" >> $GITHUB_OUTPUT
echo "alpha_ver=$(jq -r '.tag_name' <<< $alpha_json)" >> $GITHUB_OUTPUT
# Get the latest ${{ github.repository }} releases
- id: gh_currentrepo_release
name: Get latest release of this repo
run: |
beta_json=$(curl -s ${{ github.api_url }}/repos/${{ github.repository }}/releases/latest | jq)
alpha_json=$(curl -s ${{ github.api_url }}/repos/${{ github.repository }}/releases | jq 'map(select(.prerelease)) | first')
echo "beta_ver=$(jq -r '.tag_name' <<< $beta_json)" >> $GITHUB_OUTPUT
echo "alpha_ver=$(jq -r '.tag_name' <<< $alpha_json)" >> $GITHUB_OUTPUT
continue-on-error: true
outputs:
meshtastic_alpha_ver: ${{ steps.gh_meshtastic_firmware_release.outputs.alpha_ver }}
meshtastic_beta_ver: ${{ steps.gh_meshtastic_firmware_release.outputs.beta_ver }}
currentrepo_alpha_ver: ${{ steps.gh_currentrepo_release.outputs.alpha_ver }}
currentrepo_beta_ver: ${{ steps.gh_currentrepo_release.outputs.beta_ver }}

build_alpha:
needs: check
if: needs.check.outputs.currentrepo_alpha_ver != needs.check.outputs.meshtastic_alpha_ver
name: Build firmware (Alpha)
uses: ./.github/workflows/build.yml
with:
meshtastic_firmware_ref: ${{ needs.check.outputs.meshtastic_alpha_ver }}

build_beta:
needs: check
if: needs.check.outputs.currentrepo_beta_ver != needs.check.outputs.meshtastic_beta_ver
name: Build firmware (Beta)
uses: ./.github/workflows/build.yml
with:
meshtastic_firmware_ref: ${{ needs.check.outputs.meshtastic_beta_ver }}

0 comments on commit 93767e4

Please sign in to comment.