1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00
esp8266/package/deploy_package_index.sh
Earle F. Philhower, III d8b70d4a99
Copy released JSON to board URL, not new one (#8182)
* Copy released JSON to board URL, not new one

Fixes #8180

The draft release generates a ZIP and JSON.  Instead of rebuilding the ZIP
on the publish step (which may result in a different SHA256 due to file time
differences in the new ZIP), just copy the one from the published release
directly.

Also clean up and remove unneeded environment variables and CI steps.

* Be more paranoid about JSON format, check after d/l
2021-06-28 22:55:17 +02:00

30 lines
953 B
Bash

#!/bin/bash
# This script updates package index hosted on esp8266.github.io (aka arduino.esp8266.com).
tag=$(jq -r '.release.tag_name' "$GITHUB_EVENT_PATH")
if [ "$tag" == "" ]; then
tag=`git describe --tags`
fi
cd $(dirname "$0")
set -e # Abort with error if anything here does not go as expected!
# Clone the Github pages repository
git clone git@github.com:esp8266/esp8266.github.io.git
pushd esp8266.github.io
# Copy from published release, ensure JSON valid
rm -f stable/package_esp8266com_index.json
wget "https://github.com/esp8266/Arduino/releases/download/$tag/package_esp8266com_index.json" -O stable/package_esp8266com_index.json
cat stable/package_esp8266com_index.json | jq empty
git add stable/package_esp8266com_index.json
# Commit and push the changes
git config user.email "github-ci-action@github.com"
git config user.name "GitHub CI Action"
git commit -m "Update package index for release $tag"
git push origin master
popd