Action deploy to gitea rpm packages

This commit is contained in:
2025-01-26 03:39:27 +01:00
parent afba222421
commit bb75c2db3f
+38
View File
@@ -0,0 +1,38 @@
name: "Deploy rpm artifacts to Gitea packages"
description: "Upload files using curl"
author: "Daniel Demus"
inputs:
pat:
description: "A PAT that allows the actor to write to the packages API endpoint"
required: true
runs:
using: "composite"
steps:
- id: entrypoint
name: Deploy artifacts
shell: bash
run: |
set -e
cd ${{ gitea.workspace }}
SPECFILE=$([ "${{ inputs.specfile }}" ] && echo -n "${{ inputs.specfile }}" || echo -n $([ $(ls -1 *.spec 2>/dev/null| wc -l) -eq 1 ] && echo -n "$(ls -1 *.spec)"))
[ "$SPECFILE" == "" ] && exit 1
DIST="$(rpmspec --rpms --eval='%distcore')" DIST=${DIST#[.-]}
CURLARGS=(-i -s -H "Content-Type: application/octet-stream" --user ${{ gitea.actor }}:${{ inputs.pat }} --upload-file)
for RPM in $(rpmspec -q --qf '%{nevra} ' $SPECFILE); do
curl "${CURLARGS[@]}" RPMS/${RPM##*.}/$RPM.rpm ${{ gitea.server_url }}/api/packages/${{ gitea.actor }}/rpm/${{ gitea.actor }}-${DIST}/upload
echo
done
curl "${CURLARGS[@]}" SRPMS/$(rpmspec -q --srpm $SPECFILE).rpm ${{ gitea.server_url }}/api/packages/${{ gitea.actor }}/rpm/${{ gitea.actor }}-${DIST}/upload
echo
echo "Pushed the following files to the ${{ gitea.server_url }}/${{ gitea.actor }} rpm repository:"
for RPM in $(rpmspec --rpms -q --qf '%{nevra} ' $SPECFILE); do
echo $RPM.rpm
done
echo $(rpmspec -q --srpm $SPECFILE).rpm
branding:
icon: "upload"
color: "gray-dark"