Giter Club home page Giter Club logo

debian-packer's Introduction

Debian Packer

Build Debian Packages with ease!

Debian Packer Example

Contents

  1. Description
  2. Usage
    1. Simple Workflow
    2. Input Parameters
    3. Output Variables
    4. JSON Layout Map File
  3. Dependencies
  4. Contributors
  5. Copyright & Licensing

Description

This application & GitHub Action can generate and build Debian packages with ease. Simply provide the resources, a configured file map and this app will generate for you a DEBIAN package with ease! Debian Packer is ideal for applications that require Debian package to be dynamically generated, such as part of an automated release with CI/CD.

This GitHub Action can optionally be used with another one of our projects, Debian Control File Builder, which can generate the required Debian Control File for this action, if you don't already have one.

Usage

Here is a simple example of how you can use this Action in your Workflow:

Simple Workflow

name: Debian Packer Example

on:
  push:
    branches: [ master, main ]
  workflow_dispatch:

jobs:
  deb-control-file-build:
    name: Generate Debian Package
    runs-on: ubuntu-20.04

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Generate Control File
        id: control-gen
        uses: Nightwind-Developments/debian-control-file-builder@latest
        with:
          config-file: 'examples/control_file_generate/example_control_template.json'
          deps-file: 'examples/control_file_generate/dependencies.txt'
          output-path: 'examples/input_example/'

      - name: Prints Output File Path
        run: echo "${{ steps.control-gen.outputs.control_file_path }}"

      - name: Confirms Control File is Present
        run: ls ${{ steps.control-gen.outputs.control_file_path }}

      #- name: Copies control File to Intended Location (useful if Debian Control file is not in the default location)
      #  run: cp ${{ steps.control-gen.outputs.control_file_path }} examples/input_example

      - name: Prints Contents of Input Resources
        run: ls -l examples/input_example/

      - name: Build Docker Container & Run Debian Packer
        uses: Nightwind-Developments/debian-packer@latest
        id: container
        with:
          input_dir: 'examples/input_example'
          output_dir: 'output'
          layout_map_file: 'examples/example-map.json'
          package_name: 'HelloWorld'
          package_version: '1.0.0'
          package_arch: 'all'

      - name: Upload Generated Package File
        uses: actions/upload-artifact@v4
        with:
          name: generated-hello-world-package
          path: "${{ steps.container.outputs.generated_package_path }}"
          if-no-files-found: error

Input Parameters

Name Type Required Default Description
input_dir String Yes ${{ github.workspace }}/input/ Path to the directory with all the files to be included in the generated package
layout_map_file String Yes Path to JSON configuration file with how to organise the build package directory
package_name String Yes Name of the Package to be used in the file name
package_version String Yes Version number of the Package to be used in the file name
package_arch String No Architecture of the Package to be used in the file name
output_dir String No ${{ github.workspace }}/output/ Directory path to where the generated package is intended to be saved

Example use case for input parameters:

  steps:
    - name: Step Name
      with:
        input-name: value

Output Variables

Name Type Description
generated_package_path String The configured path where the generated package is saved and can be retrieved

Example use case for output variables:

    steps:
    - name: Step Name
      id: step-id
      run: ./

    - name: Print Output Variable
      run echo "${{ steps.step-id.outputs.output_variable }}"

JSON Layout Map File

A JSON File, formatted like below, can be used to specify the paths package files can be stored within the package, and subsequently post installation (with the exception of DEBIAN).

[
  {
    "name": "control",
    "path": "/DEBIAN/"
  },
  {
    "name": "postinst",
    "path": "/DEBIAN/"
  },
  {
    "name": "hello_world",
    "path": "/usr/bin/"
  }
]

Input Example

All the files that are to be included package are to be in the root path of the specified input_dir. Currently input subdirectories are not yet supported.
For example: In the case of the JSON file example above and the Simple Workflow example above, the input directory input_example should contain the following files in its root directory prior to running this Action:

  examples/input_example/
    |-- control
    |-- postinst
    |__ hello_world

Output Example

The following file structure will be present in the generated package using the configuration example above:

  .
  |-- DEBIAN
  |   |-- control
  |   |__ postinst
  |-- usr
  |   |-- bin
  |       |__ hello_world

Dependencies

The following dependencies are required for this application to run:

They can simply be installed using pip install [dependency name] ..

Contributors

The following developers have contributed to this repository:

Copyright & Licensing

Copyright (C) 2020 Nightwind Developments [email protected]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program, such as below this paragraph. If those links are not accessible, see https://www.gnu.org/licenses/.

The license for code in this repository follows LGPL-3.0-or-later.

debian-packer's People

Contributors

redhoodedwraith avatar

Stargazers

 avatar Cloudflying avatar Mark Freund avatar Felicitas Pojtinger avatar

Watchers

James Cloos avatar

Forkers

5thcolumn

debian-packer's Issues

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.