Skip to main content


Publishing to an Eik server from a Travis CI build can be achieved with a few commands.

Setup secrets in Travis

Two secrets will need to be available in order to publish to your Eik server and commit to your git repository. Travis provides a settings page where you can set secret environment variables and we recommend that you use this to do so.

The Eik server key will need to be obtained from your Eik server provider, a Github personal access token can be created by visiting this page.

Set up versioning and publishing in .travis.yml

The following gives an example of how to run version and publish commands from .travis.yml. The login command uses the EIK_SERVER_KEY that was setup in the previous step.

language: node_js
- 14
- npm i -g @eik/cli
- eik login -k $EIK_SERVER_KEY
- eik version
- eik package

If you have a build step that you need to run before publish, you could just insert that into the script section as shown.

- <build command here>
- eik login -k $EIK_SERVER_KEY
- eik version
- eik package

Create a commit script

The most challenging part of publishing from CI is committing back to your git repository. The following is an example of a script that commits changes to eik.json and pushes that commit back to github. It uses the GH_TOKEN script defined in the first step.

#!/usr/bin/env bash

# Set the repo name from the github url
# For, the repo name would be min-finn
REPO="<repo name>"

# Travis doesn't make it easy to get the current branch so... this...
BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)

# Set the user email and name for the commit, set these to whatever you prefer
git config --global ""
git config --global "Travis CI"

# Travis checks out a commit hash rather than a branch so we need to add the branch, fetch it and check it out
git remote set-branches --add origin $BRANCH
git fetch origin
git branch $BRANCH origin/$BRANCH
git checkout $BRANCH

# Push the changes to the remote
git push origin $BRANCH

Run the commit script from .travis.yml

- eik login -k $EIK_SERVER_KEY
- eik version
- eik package
- ./

Once setup, when you push changes to Github, if any of the files to be published have changed, you should automatically get a new published version of your assets on your Eik server and your eik.json file will have been updated with the new semver version number.