deploy.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #filename:deploy.sh
  2. #!/bin/bash
  3. # Deploy binaries built with travis-ci to GitHub Pages,
  4. # where they can be accessed by OpenWrt opkg directly
  5. cd /tmp/
  6. git clone https://${USER}:${TOKEN}@github.com/${USER}/${REPO}.git --branch gh-pages \
  7. --single-branch gh-pages > /dev/null 2>&1 || exit 1 # so that the key does not leak to the logs in case of errors
  8. cd gh-pages || exit 1
  9. git config user.name "cokebar"
  10. git config user.email "cokebar@cokebar.info"
  11. mkdir -p ${OSVER}
  12. pushd $OSVER
  13. cp $TRAVIS_BUILD_DIR/*.ipk .
  14. $TRAVIS_BUILD_DIR/sdk/$SDK_DIR/scripts/ipkg-make-index.sh . > Packages
  15. gzip -c Packages > Packages.gz
  16. cat > index.html <<EOF
  17. <html><body><pre>
  18. echo "src/gz announce http://${USER}.github.io/${REPO}/${OSVER}" >> /etc/opkg.conf
  19. opkg update
  20. opkg install ${PACKAGE}
  21. </pre></body></html>
  22. EOF
  23. DATE=$(date "+%Y-%m-%d")
  24. cat > README.md <<EOF
  25. OpenWrt repository for ${PACKAGE}
  26. ========
  27. Binaries built from this repository on $DATE can be downloaded from http://${USER}.github.io/${REPO}/.
  28. To install the ${PACKAGE} package, run
  29. \`\`\`
  30. echo "src/gz announce http://${USER}.github.io/${REPO}/${OSVER}" >> /etc/opkg.conf
  31. opkg update
  32. opkg install ${PACKAGE}
  33. \`\`\`
  34. EOF
  35. git add -A
  36. popd
  37. #git pull
  38. git commit -a -m "Deploy Travis build $TRAVIS_BUILD_NUMBER to gh-pages"
  39. #git push -fq origin gh-pages:gh-pages > /dev/null 2>&1 || exit 1
  40. git push -fq origin gh-pages > /dev/null 2>&1 || exit 1 # so that the key does not leak to the logs in case of errors
  41. #git push -f origin gh-pages:gh-pages
  42. echo -e "Uploaded files to gh-pages\n"
  43. cd -