deploy.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. git rm -rf *.ipk
  14. cp $TRAVIS_BUILD_DIR/*.ipk .
  15. $TRAVIS_BUILD_DIR/sdk/$SDK_DIR/scripts/ipkg-make-index.sh . > Packages
  16. gzip -c Packages > Packages.gz
  17. cat > index.html <<EOF
  18. <html><body><pre>
  19. echo "src/gz announce http://${USER}.github.io/${REPO}/${OSVER}" >> /etc/opkg.conf
  20. opkg update
  21. opkg install ${PACKAGE}
  22. </pre></body></html>
  23. EOF
  24. DATE=$(date "+%Y-%m-%d")
  25. cat > README.md <<EOF
  26. OpenWrt repository for ${PACKAGE}
  27. ========
  28. Binaries built from this repository on $DATE can be downloaded from http://${USER}.github.io/${REPO}/.
  29. To install the ${PACKAGE} package, run
  30. \`\`\`
  31. echo "src/gz announce http://${USER}.github.io/${REPO}/${OSVER}" >> /etc/opkg.conf
  32. opkg update
  33. opkg install ${PACKAGE}
  34. \`\`\`
  35. EOF
  36. git add -A
  37. popd
  38. #git pull
  39. git commit -a -m "Deploy Travis build $TRAVIS_BUILD_NUMBER to gh-pages"
  40. #git push -fq origin gh-pages:gh-pages > /dev/null 2>&1 || exit 1
  41. 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
  42. #git push -f origin gh-pages:gh-pages
  43. echo -e "Uploaded files to gh-pages\n"
  44. cd -