- Notifications
You must be signed in to change notification settings - Fork0
A Github action for building Snapcraft projects
License
snapcore/action-build
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a Github Action that can be used to build aSnapcraft project. For most projects, thefollowing workflow should be sufficient:
jobs:build:runs-on:ubuntu-lateststeps: -uses:actions/checkout@v4 -uses:snapcore/action-build@v1
This will install and configure LXD and Snapcraft, then invokesnapcraft
to build the project.
On success, the action will set thesnap
output parameter to thepath of the built snap. This can be used to save it as an artifact ofthe workflow:
... -uses:snapcore/action-build@v1id:snapcraft -uses:actions/upload-artifact@v3with:name:snappath:${{ steps.snapcraft.outputs.snap }}
Alternatively, it could be used to perform further testing on the built snap:
-run:| sudo snap install --dangerous ${{ steps.snapcraft.outputs.snap }} # do something with the snap
The action can also be chained withsnapcore/action-publish@v1
to automatically publish builds to the Snap Store.
If your Snapcraft project is not located in the root of the workspace,you can specify an alternative location via thepath
inputparameter:
... -uses:snapcore/action-build@v1with:path:path-to-snapcraft-project
By default, the action will tell Snapcraft to include informationabout the build in the resulting snap, in the form of thesnap/snapcraft.yaml
andsnap/manifest.yaml
files. Among otherthings, these are used by the Snap Store's automatic securityvulnerability scanner to check whether your snap includes files fromvulnerable versions of Ubuntu packages.
This can be turned off by setting thebuild-info
parameter tofalse
.
By default, the action will install Snapcraft from the stablechannel. If your project relies on a feature not found in the stableversion of Snapcraft, then thesnapcraft-channel
parameter can beused to select a different channel.
Thesnapcraft-args
parameter can be used to pass additionalarguments to Snapcraft. This is primarily intended to allow the useof experimental features by passing--enable-experimental-*
arguments to Snapcraft.
Theua-token
parameter can be used to tell Snapcraft to attach an UbuntuAdvantage (UA) token inside the build environment. Snapcraft will ensurethe token is detached before exiting, but be warned that it is possiblesome failures may prevent detaching (e.g. aborted jobs).
In order to make the UA token available to the workflow, it should be storedas a repository secret:
- choose the "Settings" tab.
- choose "Secrets" from the menu on the left.
- click "Add a new secret".
- set the name to
UA_TOKEN
(or whatever is referenced in the workflow),and paste the UA token as the value.
Note that repository secrets are not available to workflows triggeredby pull requests to public repositories.
An example workflow with UA token stored as secretUA_TOKEN
:
... -uses:snapcore/action-build@v1with:ua-token:${{ secrets.UA_TOKEN }}
About
A Github action for building Snapcraft projects
Resources
License
Stars
Watchers
Forks
Packages0
Languages
- JavaScript96.2%
- C1.9%
- Meson1.9%