Build and publish snaps from Git
You can build and publish snaps of commits to your Git repository so that other developers or early adopters can try the latest changes to your application.
This is an entirely automated process. Once set up, you should not need to touch it again.
Extending your Travis CI configuration to build and publish snaps on branch commits is easy. Run
snapcraft enable-ci travis and you will be guided through the process.
Note that you should already have the following:
- The Travis command line client installed.
.travis.ymlfile in your project directory.
- Travis enabled for your repository and configured to “build pushes.”
Travis does not currently support open source projects building on non-x86 architectures or builds that take longer than 50 minutes. Launchpad can be set up as an alternative with no restrictions placed on build time and support for the following architectures:
- AMD x86-64 (amd64)
- ARM ARMv8 (arm64)
- ARM ARMv7 Hard Float (armhf)
- Intel x86 (i386)
- PowerPC64 Little-Endian (ppc64el)
First, create an account on Launchpad and a project to host the build:
Once registered, you can find your project listed under your account.
Now, configure the project to point at your existing Git repository:
- From your project’s main page, follow the “Code” link under “Configuration options”
- Select “Git” under “Version control system”
- Select “Import a Git repository hosted somewhere else” under “Link or import an existing repository”
- In a new tab or window, go to your GitHub repository page and click the button for “Clone or download”
- Select “Use HTTPS” and then click the “copy to clickboard” button
- Back on the Launchpad page, paste the text from GitHub in the “Git repository URL” box and click the “update” button
Launchpad will now schedule an import of your GitHub repo. This will only take a few minutes. Grab a coffee, refresh the page, and you should see each of your branches listed.
Finally, tell Launchpad to build and publish snaps for this repository:
- Under the “Branches” heading, click on the branch you would like to publish snaps for
- In a new tab or window, go to the snap name registration page, signing in with the acount you created at Launchpad
- Type the name of your application in the “Snap name” field, then click on the “Register and proceed to upload” button
- Close this tab and return to the branch page on Launchpad
- Under the “Related snap packages” heading, click “Create snap package”
- In the “Name” field, enter the same name you used on the snap name registration page
- Under “Processors”, select any hardware architectures you wish to build snaps for
- Check the box for “Automatically build when branch changes”
- Check the box for “Automatically upload to store”
- Enter the name of your application in the “Registered store package name” field
- Under “Store channels” select “Edge”
- Click “Create snap package”
Congratulations, you’re all set. Four times a day Launchpad will check to see if any new commits have been pushed to your GitHub repository and will both build and publish snaps of them to the edge channel.
Your system can then automatically refresh this snap to the latest version, up to four times a day. To set that up, run
snap install --edge <snap name>.