Download Firmware #64
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: Download Firmware | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs every day at midnight | |
# You can also trigger this workflow manually or on other events | |
workflow_dispatch: | |
jobs: | |
download-and-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Get Latest Release | |
id: get-release | |
run: | | |
LATEST_RELEASE=$(curl -s https://api.github.com/repos/skot/ESP-Miner/releases/latest) | |
RELEASE_TAG=$(echo $LATEST_RELEASE | jq -r .tag_name) | |
echo "::set-output name=tag_name::$RELEASE_TAG" | |
- name: Download Specific Binary File | |
run: | | |
FILE_URL=$(curl -s https://api.github.com/repos/skot/ESP-Miner/releases/latest | jq -r '.assets[] | select(.name | startswith("esp-miner-factory-204-")) | .browser_download_url') | |
wget -O firmware/bitaxe-os-latest.bin $FILE_URL | |
- name: Check for Changes | |
id: check-changes | |
run: | | |
git diff --exit-code || echo "::set-output name=changes_detected::true" | |
- name: Commit and Push | |
if: steps.check-changes.outputs.changes_detected == 'true' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add firmware/bitaxe-os-latest.bin | |
git commit -m "Update firmware binary to ${{ steps.get-release.outputs.tag_name }}" | |
git push --set-upstream origin HEAD:master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |