Check_firmware #584
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: Check_firmware | |
on: | |
schedule: | |
- cron: '30 1 * * *' | |
jobs: | |
Check_firmware: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Update repositories | |
run: sudo apt-get update | |
- name: Get jq & curl | |
run: sudo apt-get install curl jq | |
- name: Write newest firmware versions to file | |
env: | |
CONCEPT2_API_TOKEN: ${{ secrets.CONCEPT2_API_TOKEN }} | |
run: | | |
curl -s "https://tech.concept2.com/api/firmware/latest" -H "Authorization: Basic ""$CONCEPT2_API_TOKEN" | jq -r '.data[] | [.status, .machine, .release_date, .short_description, .files[0].name] | @tsv' > current_versions.txt | |
- name: Write newest firmware URLS to file | |
env: | |
CONCEPT2_API_TOKEN: ${{ secrets.CONCEPT2_API_TOKEN }} | |
run: | | |
FILES=$(curl -s "https://tech.concept2.com/api/firmware/latest" -H "Authorization: Basic ""$CONCEPT2_API_TOKEN" | jq -r '.data[] | select(.status == "public") | .files[0].name' | paste -s -d, -) | |
cat > updater.sh <<EOF | |
#!/bin/bash | |
DESTINATION=\$HOME/Downloads/Concept2/Firmware | |
mkdir -p \$DESTINATION | |
cd \$DESTINATION | |
FILES=\$($FILES) | |
curl -s -O "https://firmware.concept2.com/files/{\$FILES}" | |
EOF | |
- name: Create Pull Request | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Github Actions found newer firmware |