Skip to content

Commit

Permalink
add: new output parameters 'file_name' and 'debuginfo_file_name' #12 (#…
Browse files Browse the repository at this point in the history
…13)

* add: add new output parameter 'file_name' #12

* add: build script

* fix: bump minor

* add: CI test

* fix: script
  • Loading branch information
jiro4989 authored Nov 9, 2023
1 parent a28c23d commit 6a966c1
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ jobs:
This is sample package.
This is sample package.
id: build
- run: |
docker run --rm -v $PWD:/work -t centos:7 bash -c 'rpm -Uvh /work/*.rpm && testbin'
- name: Test file_name
run: test ${{ steps.build.outputs.file_name }} = 'testbin-1.0.0-1.el7.x86_64.rpm'
- name: Test debuginfo_file_name
run: test ${{ steps.build.outputs.debuginfo_file_name }} = 'testbin-debuginfo-1.0.0-1.el7.x86_64.rpm'

test-script-version:
runs-on: ubuntu-latest
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ inputs:

```

## Output

```yaml
outputs:
file_name:
description: 'File name of resulting .rpm file. This does not contain a debuginfo file.'
debuginfo_file_name:
description: 'File name of resulting .rpm debuginfo file.'
```
## Usage
```yaml
Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ inputs:
post:
description: 'Package post.'
default: ''
outputs:
file_name:
description: 'File name of resulting .rpm file. This does not contain a debuginfo file.'
debuginfo_file_name:
description: 'File name of resulting .rpm debuginfo file.'
runs:
using: 'docker'
image: 'docker://jiro4989/build-rpm-action:2.3.0'
image: 'docker://jiro4989/build-rpm-action:2.4.0'

# Ref: https://haya14busa.github.io/github-action-brandings/
# TODO: update branding if you want.
Expand Down
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -eu

version=$1
tag="jiro4989/build-rpm-action:$version"
docker build --no-cache -t "$tag" .
docker push "$tag"
18 changes: 18 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,21 @@ readonly RPMBUILD_SPEC_DIR="$RPMBUILD_DIR/SPECS"
cp -p "$RPMBUILD_DIR/RPMS/$(uname -m)"/*.rpm .

ls -lah ./*.rpm

# for grep
set +e

for f in *.rpm; do
# exclude debuginfo file
line_count="$(echo "$f" | grep -Eoc "^${INPUT_PACKAGE}-debuginfo-")"
if [ "$line_count" -ne 0 ]; then
RPM_DEBUGINFO_FILE="$f"
continue
fi
RPM_FILE="$f"
done

set -e

echo "file_name=$RPM_FILE" >> "${GITHUB_OUTPUT}"
echo "debuginfo_file_name=$RPM_DEBUGINFO_FILE" >> "${GITHUB_OUTPUT}"

0 comments on commit 6a966c1

Please sign in to comment.