forked from waja/action-debian-package
init
This commit is contained in:
parent
c68af108d8
commit
d3ce6af944
16
.github/workflows/test.yml
vendored
Normal file
16
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
name: Test Action
|
||||||
|
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Clone repo
|
||||||
|
run: git clone https://salsa.debian.org/ruby-team/lolcat.git -b debian/100.0.1-2
|
||||||
|
- name: Test run
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
directory: lolcat
|
|
@ -1,7 +1,5 @@
|
||||||
FROM alpine:3.10
|
FROM docker
|
||||||
|
|
||||||
COPY LICENSE README.md /
|
COPY main.sh /
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
ENTRYPOINT ["/main.sh"]
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2018 GitHub, Inc. and contributors
|
Copyright (c) 2020 Dawid Dziurla
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
14
README.md
14
README.md
|
@ -1,5 +1,13 @@
|
||||||
# Container Action Template
|
# Build Debian package Github Action
|
||||||
|
|
||||||
To get started, click the `Use this template` button on this repository [which will create a new repository based on this template](https://github.blog/2019-06-06-generate-new-repositories-with-repository-templates/).
|
An action that builds a Debian package from source for specified distribution.
|
||||||
|
|
||||||
For info on how to build your first Container action, see the [toolkit docs folder](https://github.com/actions/toolkit/blob/master/docs/container-action.md).
|
## Usage
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Build Debian package
|
||||||
|
uses: dawidd6/action-debian-package@master
|
||||||
|
with:
|
||||||
|
directory: ./
|
||||||
|
os: debian
|
||||||
|
```
|
||||||
|
|
23
action.yml
23
action.yml
|
@ -1,12 +1,15 @@
|
||||||
name: 'Container Action Template'
|
name: Build Debian package
|
||||||
description: 'Get started with Container actions'
|
description: Build Debian package from source for selected target release
|
||||||
author: 'GitHub'
|
branding:
|
||||||
|
color: red
|
||||||
|
icon: package
|
||||||
inputs:
|
inputs:
|
||||||
myInput:
|
directory:
|
||||||
description: 'Input to use'
|
description: Directory where Debianized sources live (defaults to current)
|
||||||
default: 'world'
|
required: false
|
||||||
|
os:
|
||||||
|
description: '"ubuntu" or "debian" (defaults to "debian")'
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: docker
|
||||||
image: 'Dockerfile'
|
image: Dockerfile
|
||||||
args:
|
|
||||||
- ${{ inputs.myInput }}
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/sh -l
|
|
||||||
|
|
||||||
echo "hello $1"
|
|
45
main.sh
Executable file
45
main.sh
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
directory="${INPUT_DIRECTORY:-$PWD}"
|
||||||
|
os="${INPUT_OS:-"debian"}"
|
||||||
|
|
||||||
|
cd "$directory"
|
||||||
|
|
||||||
|
package="$(dpkg-parsechangelog -S Source)"
|
||||||
|
version="$(dpkg-parsechangelog -S Version)"
|
||||||
|
distribution="$(dpkg-parsechangelog -S Distribution | sed 's/UNRELEASED/unstable/')"
|
||||||
|
|
||||||
|
container="builder"
|
||||||
|
image="$os:$distribution"
|
||||||
|
workdir="/build/source"
|
||||||
|
|
||||||
|
docker create \
|
||||||
|
--name "$container" \
|
||||||
|
--volume "$directory":"$workdir" \
|
||||||
|
--workdir "$workdir" \
|
||||||
|
"$image" \
|
||||||
|
sleep inf
|
||||||
|
|
||||||
|
docker exec \
|
||||||
|
--tty \
|
||||||
|
"$container" \
|
||||||
|
apt-get update
|
||||||
|
|
||||||
|
docker exec \
|
||||||
|
--tty \
|
||||||
|
"$container" \
|
||||||
|
apt-get install dpkg-dev debhelper
|
||||||
|
|
||||||
|
docker exec \
|
||||||
|
--tty \
|
||||||
|
--workdir "$workdir" \
|
||||||
|
"$container" \
|
||||||
|
apt-get build-dep ./
|
||||||
|
|
||||||
|
docker exec \
|
||||||
|
--tty \
|
||||||
|
--workdir "$workdir" \
|
||||||
|
"$container" \
|
||||||
|
dpkg-buildpackage -S -us -uc
|
Loading…
Reference in a new issue