Skip to content

Instantly share code, notes, and snippets.

@Maxim-Filimonov
Last active July 19, 2016 02:38
Show Gist options
  • Save Maxim-Filimonov/7459401 to your computer and use it in GitHub Desktop.
Save Maxim-Filimonov/7459401 to your computer and use it in GitHub Desktop.
Precompile assets on codeship
# Assuming that you have followed all the instructions from https://github.com/rumblelabs/asset_sync
# Put this in your deployment script
# Choose any environment here the important part is that your environment is using the same bucket for all environments
# than you only need to precompile assets once
RAILS_ENV=staging bundle exec rake assets:precompile
# You need to set git credentials otherwise it won't be able to commit
git config --global user.email "codeship@codeship.com"
git config --global user.name "Codeship Server"
# Add your manifest file so that rails can find digested version of files
git add --force public/assets/manifest*.json
# Commit with special --skip-ci command which indicates to codeship to ignore this commit. To avoid infinite build.
git commit -m "Update assets --skip-ci"
# Because it's in detached head a bit funky syntax required to push changes back to your master
git push git@github.com:<owner/name_of_your_repo>.git HEAD:master
# .cloud66/manifest.yml
development:
rails:
configuration:
use_asset_pipeline: false
qa:
rails:
configuration:
use_asset_pipeline: false
staging:
rails:
configuration:
use_asset_pipeline: false
production:
rails:
configuration:
use_asset_pipeline: false
@jorgenj
Copy link

jorgenj commented Sep 4, 2014

On codeship, you may want to replace that last line 'git push...' with the following:

git push git@github.com:<owner/name_of_your_repo>.git HEAD:$CI_BRANCH

Also, if you're using bitbucket repos, you will have to find a way work around the fact that codeship uses 'deployment' keys to fetch your repo contents (which have read-only access in bitbucket).

@ruyaoyao
Copy link

just deployment key from the repo, and add it to your ssh keys settings for all repo. That will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment