Build Meshtastic firmware for AMD64 #68
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 Meshtastic firmware for AMD64 | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install wget g++ zip ca-certificates jq | |
pip install --upgrade pip | |
pip install platformio | |
- name: Download last known tag if available | |
id: download-tag | |
uses: actions/download-artifact@v2 | |
with: | |
name: last-known-tag | |
path: . | |
- name: Check for new Meshtastic firmware release | |
id: check-release | |
run: | | |
if [ -f "last_known_tag.txt" ]; then | |
LAST_KNOWN_TAG=$(cat last_known_tag.txt) | |
else | |
LAST_KNOWN_TAG="" | |
fi | |
LATEST_TAG=$(curl -s https://api.github.com/repos/meshtastic/firmware/releases/latest | jq -r .tag_name) | |
echo "Latest tag is $LATEST_TAG" | |
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV | |
if [ "$LATEST_TAG" != "$LAST_KNOWN_TAG" ]; then | |
echo "A new release is available, proceeding with the build." | |
else | |
echo "No new release found, skipping the build." | |
exit 0 | |
# ... rest of your original steps to build the firmware ... | |
- name: Upload firmware to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: /tmp/firmware/release/meshtasticd_linux_amd64 | |
asset_name: meshtasticd_linux_amd64 | |
tag: ${{ env.TAG }} | |
overwrite: true | |
body: "Meshtastic amd64 firmware" | |
- name: Update and upload last known tag | |
if: success() | |
run: | | |
echo "$LATEST_TAG" > last_known_tag.txt | |
echo "Updating last known tag to $LATEST_TAG" | |
- name: Upload new last known tag as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: last-known-tag | |
path: last_known_tag.txt |