Compare commits
24 Commits
011be46064
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c6628c58b5 | |||
| 8af940127f | |||
| 0cc905a79d | |||
| 9e40736cb7 | |||
| 04353ee147 | |||
| 3197993322 | |||
| 468f09a7a1 | |||
| 1bbc46c940 | |||
| d6ae96507b | |||
| 62e9b183cc | |||
| cc025c1767 | |||
| 5975c89780 | |||
| d03ee8b339 | |||
| f9a61a2d96 | |||
| 22d2f09bdf | |||
| ff054b53a0 | |||
| fe5f762047 | |||
| 7041c5f4ad | |||
| 9ab81474ec | |||
| 2fd8e42566 | |||
| b8bebe76ec | |||
| 93846393e8 | |||
| 1fcd5a5848 | |||
| b2af6b1792 |
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
A gitea action to build rpm with a given spec file.
|
A gitea action to build rpm with a given spec file.
|
||||||
|
|
||||||
Make sure that podman is installed
|
Make sure that podman and iptables are installed
|
||||||
|
|||||||
55
action.yml
55
action.yml
@@ -1,9 +1,24 @@
|
|||||||
name: Build RPM
|
name: Build and Upload RPM
|
||||||
description: "Builds rpm for given spec file"
|
description: "Builds rpm for given spec file and uploads to hydrosaber gitea repository."
|
||||||
inputs:
|
inputs:
|
||||||
spec-file-path:
|
spec-file-path:
|
||||||
description: "Path to spec file for rpm"
|
description: "Path to spec file for rpm"
|
||||||
required: true
|
required: true
|
||||||
|
package-group:
|
||||||
|
description: "Group repository to upload package to"
|
||||||
|
default: "f43"
|
||||||
|
repository-url:
|
||||||
|
description: "Gitea repository to upload package to"
|
||||||
|
default: "https://git.hydrosaber.com"
|
||||||
|
repository-user:
|
||||||
|
description: "User in repository to upload as"
|
||||||
|
required: true
|
||||||
|
repository-user-token:
|
||||||
|
description: "Token to use with user"
|
||||||
|
required: true
|
||||||
|
extra-source-directory:
|
||||||
|
description: "(Optional) Directory to grab files for sources."
|
||||||
|
default: ""
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
@@ -16,15 +31,49 @@ runs:
|
|||||||
mkdir -p ./rpmbuild/{RPMS,SPECS}
|
mkdir -p ./rpmbuild/{RPMS,SPECS}
|
||||||
cp ${SPEC_FILE_PATH} ./rpmbuild/SPECS
|
cp ${SPEC_FILE_PATH} ./rpmbuild/SPECS
|
||||||
|
|
||||||
|
- name: Add extra source files
|
||||||
|
shell: bash
|
||||||
|
if: "${{ inputs.extra-source-directory != '' }}"
|
||||||
|
env:
|
||||||
|
SOURCE_DIRECTORY: ${{ inputs.extra-source-directory }}
|
||||||
|
run: |
|
||||||
|
mkdir -p ./rpmbuild/PATCHES
|
||||||
|
find ${SOURCE_DIRECTORY} -type f -not -name "*\.spec" \
|
||||||
|
-exec cp {} ./rpmbuild/PATCHES \;
|
||||||
|
|
||||||
- name: Build RPM
|
- name: Build RPM
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
SPEC_FILE_PATH: ${{ inputs.spec-file-path }}
|
SPEC_FILE_PATH: ${{ inputs.spec-file-path }}
|
||||||
|
ACTION_ROOT: ${{ gitea.action_path }}
|
||||||
run: |
|
run: |
|
||||||
SPEC_FILE_NAME=$(basename ${SPEC_FILE_PATH})
|
SPEC_FILE_NAME=$(basename ${SPEC_FILE_PATH})
|
||||||
podman run --rm \
|
podman run --rm \
|
||||||
-v ./rpmbuild:/root/rpmbuild:rw,z \
|
-v ./rpmbuild:/root/rpmbuild:rw,z \
|
||||||
-v ./entrypoint.sh:/root/entrypoint.sh:ro,z \
|
-v ${ACTION_ROOT}/entrypoint.sh:/root/entrypoint.sh:ro,z \
|
||||||
-w /root \
|
-w /root \
|
||||||
fedora:latest \
|
fedora:latest \
|
||||||
/root/entrypoint.sh /root/rpmbuild/SPECS/${SPEC_FILE_NAME}
|
/root/entrypoint.sh /root/rpmbuild/SPECS/${SPEC_FILE_NAME}
|
||||||
|
|
||||||
|
- name: Upload package
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
SPEC_FILE_PATH: ${{ inputs.spec-file-path }}
|
||||||
|
REPOSITORY_URL: ${{ inputs.repository-url }}
|
||||||
|
PACKAGE_GROUP: ${{ inputs.package-group }}
|
||||||
|
REPOSITORY_OWNER: ${{ gitea.repository_owner }}
|
||||||
|
UPLOAD_USER: ${{ inputs.repository-user }}
|
||||||
|
UPLOAD_USER_TOKEN: ${{ inputs.repository-user-token }}
|
||||||
|
run: |
|
||||||
|
PACKAGE_NAME=$(basename -s .spec ${SPEC_FILE_PATH})
|
||||||
|
echo "Goal package to upload: ${PACKAGE_NAME}"
|
||||||
|
RPM_PATH="./rpmbuild/RPMS/"
|
||||||
|
echo "Searching in ${RPM_PATH}"
|
||||||
|
find ./rpmbuild/RPMS/ -type f -name "*.rpm"
|
||||||
|
UPLOAD_URL="${REPOSITORY_URL}/api/packages/${REPOSITORY_OWNER}/rpm/${PACKAGE_GROUP}/upload"
|
||||||
|
echo "Uploading to url: ${UPLOAD_URL}"
|
||||||
|
find ./rpmbuild/RPMS/ -name "*.rpm" -type f \
|
||||||
|
-exec curl \
|
||||||
|
--user ${UPLOAD_USER}:${UPLOAD_USER_TOKEN} \
|
||||||
|
--upload-file {} \
|
||||||
|
${UPLOAD_URL} \;
|
||||||
|
|||||||
16
entrypoint.sh
Normal file → Executable file
16
entrypoint.sh
Normal file → Executable file
@@ -1,11 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
dnf -y config-manager --add-repo https://git.hydrosaber.com/api/packages/hydros/rpm/f43.repo
|
echo "--- Start adding repos and priorities ---"
|
||||||
|
dnf5 -y config-manager addrepo --from-repofile=https://git.hydrosaber.com/api/packages/hydros/rpm/f43.repo
|
||||||
|
|
||||||
dnf -y install rpmdevtools
|
echo "--- Setup workspace and packages ---"
|
||||||
|
dnf5 -y install rpmdevtools
|
||||||
rpmdev-setuptree
|
rpmdev-setuptree
|
||||||
|
|
||||||
dnf -y builddep $1
|
dnf5 -y builddep $1
|
||||||
|
|
||||||
|
echo "--- Download sources ---"
|
||||||
rpmdev-spectool -g -C ~/rpmbuild/SOURCES $1
|
rpmdev-spectool -g -C ~/rpmbuild/SOURCES $1
|
||||||
rpmbuild --nodebuginfo --bb $1
|
|
||||||
|
echo "--- Add patches ---"
|
||||||
|
cp ~/rpmbuild/PATCHES/* ~/rpmbuild/SOURCES
|
||||||
|
|
||||||
|
echo "--- Build RPM packages ---"
|
||||||
|
rpmbuild --nodebuginfo --bb $1 && echo "--- Done! ---"
|
||||||
|
|||||||
Reference in New Issue
Block a user