Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload APK to Github with TravisCI

There is a bash script to upload APK file to GitHub repository after successful TravisCI build.

  mkdir $HOME/buildApk/
  mkdir $HOME/android/

  cp -R app/build/outputs/apk/app-debug.apk $HOME/android/
  cd $HOME
  git config --global user.email "[email protected]"
  git config --global user.name "Akos Kovacs" 

  git clone --quiet --branch=master  https://plaidshirtakos:[email protected]/plaidshirtakos/Trivia-test  master > /dev/null
  cd master cp -Rf $HOME/android/* .

  git add -f .
  git remote rm origin
  git remote add origin https://plaidshirtakos:[email protected]/plaidshirtakos/Trivia-test.git
  git add -f .
  git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed"
  git push -fq origin master > /dev/null
  echo "Done"

I see following lines in log.

On branch master nothing to commit, working tree clean Done

like image 597
plaidshirt Avatar asked Sep 19 '17 09:09

plaidshirt


People also ask

Can I add APK in GitHub?

Automate building with GitHub and Build Android APK on every push to GitHub, recurrently or manually. Set up the Continuous Integration and Delivery (CI/CD) workflow with GitHub, GitHub, Build Android APK and Buddy in minutes. Build test & deploy instantly. Turn DevOps into NoOps with Buddy's automation.

How do I upload a Projecton to GitHub?

On GitHub.com, navigate to the main page of the repository. Above the list of files, using the Add file drop-down, click Upload files. Drag and drop the file or folder you'd like to upload to your repository onto the file tree.

How do I add an app code to GitHub?

Go to File -> Settings -> Version Control -> GitHub. Enter your email and password used to create GitHub account and click on OK button. Then go to VCS -> Import into Version Control -> Share Project on GitHub. Enter Repository name, Description and click Share button.


1 Answers

You may miss git add command.

git add -A

-f is "Allow adding otherwise ignored files."

-A is "If no <pathspec> is given when -A option is used, all files in the entire working tree are updated"

Changed your sample code:

mkdir $HOME/buildApk/
mkdir $HOME/android/

cp -R app/build/outputs/apk/*.apk $HOME/android/
cd $HOME
git config --global user.email "[email protected]"
git config --global user.name "Akos Kovacs" 

git clone --depth=10 --branch=master  https://plaidshirtakos:[email protected]/plaidshirtakos/Trivia-test  master > /dev/null
cd master
cp -Rf $HOME/android/* .

git add -A
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed"
git push -fq origin master > /dev/null
echo "Done"

See also a sample that use ssh+git:

https://github.com/indication/OpenRedmine/blob/development/external/report.sh

like image 162
okud Avatar answered Sep 28 '22 12:09

okud