forked from waja/action-debian-package
Add optional os_distribution parameter (#29)
* Add optional os_distribution parameter Fixes #28 Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
This commit is contained in:
parent
5513f52a10
commit
fb3670aed9
|
@ -12,4 +12,6 @@ An action that builds a Debian package from source in a Docker container.
|
|||
source_directory: lolcat
|
||||
# Optional, relative to workspace directory
|
||||
artifacts_directory: output
|
||||
# Optional, value from `debian/changelog` is used if not defined
|
||||
os_distribution: bionic
|
||||
```
|
||||
|
|
|
@ -12,6 +12,9 @@ inputs:
|
|||
description: Directory where build artifacts will be placed, relative to workspace
|
||||
required: false
|
||||
default: ./
|
||||
os_distribution:
|
||||
description: OS distribution name, value from `debian/changelog` is used if not defined
|
||||
required: false
|
||||
runs:
|
||||
using: node12
|
||||
main: main.js
|
||||
|
|
6
main.js
6
main.js
|
@ -30,6 +30,7 @@ async function main() {
|
|||
try {
|
||||
const sourceRelativeDirectory = core.getInput("source_directory") || "./"
|
||||
const artifactsRelativeDirectory = core.getInput("artifacts_directory") || "./"
|
||||
const osDistribution = core.getInput("os_distribution") || ""
|
||||
|
||||
const workspaceDirectory = process.cwd()
|
||||
const sourceDirectory = path.join(workspaceDirectory, sourceRelativeDirectory)
|
||||
|
@ -38,9 +39,10 @@ async function main() {
|
|||
|
||||
const file = path.join(sourceDirectory, "debian/changelog")
|
||||
const changelog = await firstline(file)
|
||||
const regex = /^(?<pkg>.+) \(((?<epoch>[0-9]+):)?(?<version>[^:-]+)(-(?<revision>[^:-]+))?\) (?<distribution>.+);/
|
||||
const regex = /^(?<pkg>.+) \(((?<epoch>[0-9]+):)?(?<version>[^:-]+)(-(?<revision>[^:-]+))?\) (?<packageDistribution>.+);/
|
||||
const match = changelog.match(regex)
|
||||
const { pkg, epoch, version, revision, distribution } = match.groups
|
||||
const { pkg, epoch, version, revision, packageDistribution } = match.groups
|
||||
const distribution = osDistribution ? osDistribution : packageDistribution
|
||||
const imageName = await getImageName(distribution)
|
||||
const imageTag = await getImageTag(imageName, distribution)
|
||||
const container = pkg
|
||||
|
|
Loading…
Reference in a new issue