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 6, 2024
1 parent c63d586 commit bd29669
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 10 deletions.
64 changes: 54 additions & 10 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
# 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"
# # 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 Down Expand Up @@ -54,14 +74,14 @@ jobs:
release/*.uf2
release/*.elf
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
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 +123,27 @@ jobs:
overwrite: true
path: |
${{ matrix.artifact-paths }}
release:
name: Release ${{ inputs.meshtastic_firmware_ref || 'master' }}
if: (inputs.meshtastic_firmware_ref || 'master') != 'master'
runs-on: ubuntu-24.04
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: firmware-*.zip
path: release

- name: Create Release
uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: true
name: Meshtastic Firmware ${{ env.meshtastic_firmware_ref }}
tag_name: ${{ env.meshtastic_firmware_ref }}
body: |
Autogenerated by github action, developer should edit as required before publishing...
files: |
release/*
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: Nightly - Check for upstream changes
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 bd29669

Please sign in to comment.