GithubHelp home page GithubHelp logo

jnsgruk / action-build Goto Github PK

View Code? Open in Web Editor NEW

This project forked from snapcore/action-build

0.0 1.0 0.0 1023 KB

A Github action for building Snapcraft projects

License: MIT License

JavaScript 96.95% C 1.53% Meson 1.53%

action-build's Introduction

snapcraft-build-action status

Snapcraft Build Action

This is a Github Action that can be used to build a Snapcraft project. For most projects, the following workflow should be sufficient:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: snapcore/action-build@v1

This will install and configure LXD and Snapcraft, then invoke snapcraft to build the project.

On success, the action will set the snap output parameter to the path of the built snap. This can be used to save it as an artifact of the workflow:

...
    - uses: snapcore/action-build@v1
      id: snapcraft
    - uses: actions/upload-artifact@v3
      with:
        name: snap
        path: ${{ 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 with snapcore/action-publish@v1 to automatically publish builds to the Snap Store.

Action inputs

path

If your Snapcraft project is not located in the root of the workspace, you can specify an alternative location via the path input parameter:

...
    - uses: snapcore/action-build@v1
      with:
        path: path-to-snapcraft-project

build-info

By default, the action will tell Snapcraft to include information about the build in the resulting snap, in the form of the snap/snapcraft.yaml and snap/manifest.yaml files. Among other things, these are used by the Snap Store's automatic security vulnerability scanner to check whether your snap includes files from vulnerable versions of Ubuntu packages.

This can be turned off by setting the build-info parameter to false.

snapcraft-channel

By default, the action will install Snapcraft from the stable channel. If your project relies on a feature not found in the stable version of Snapcraft, then the snapcraft-channel parameter can be used to select a different channel.

snapcraft-args

The snapcraft-args parameter can be used to pass additional arguments to Snapcraft. This is primarily intended to allow the use of experimental features by passing --enable-experimental-* arguments to Snapcraft.

ua-token

The ua-token parameter can be used to tell Snapcraft to attach an Ubuntu Advantage (UA) token inside the build environment. Snapcraft will ensure the token is detached before exiting, but be warned that it is possible some failures may prevent detaching (e.g. aborted jobs).

In order to make the UA token available to the workflow, it should be stored as a repository secret:

  1. choose the "Settings" tab.
  2. choose "Secrets" from the menu on the left.
  3. click "Add a new secret".
  4. 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 triggered by pull requests to public repositories.

An example workflow with UA token stored as secret UA_TOKEN:

...
    - uses: snapcore/action-build@v1
      with:
        ua-token: ${{ secrets.UA_TOKEN }}

action-build's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.