Add license, workflow for composer package

This commit is contained in:
2025-07-05 18:25:15 +02:00
parent bf22526bc0
commit 826f35c1a1
3 changed files with 360 additions and 0 deletions

40
.gitea/composer-gitea-publish Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env bash
#
# This script will publish a package to a Gitea Composer package repository.
# Developed as part of NoccyLabs workflows, Copyright 2025 NoccyLabs
# Licensed under GPL 2.0 or later.
#
# Arguments:
# server - The domain component of the Gitea server hosting the repository
# owner - The owner of the package repository on the Gitea instance
# auth - Credentials, in the form user:token
#
# _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
if [ -z $3 ]; then
echo "Usage: $0 <giteadomain> <owner> <user:token>" 1>&2
exit 1
fi
# grab arguments
server=$1
owner=$2
auth=$3
# determine package name (from composer.json) and version (from git tag)
pct_package="$(cat composer.json | jq -r .name)"
pct_version="$(git describe --tags)"
pct_filename="$(echo "$pct_package" | sed 's/\//-/')--$pct_version.zip"
# make sure the package's composer.json contains the version key
jq ".version = \"$tag\"" composer.json > composer.json~ &&
mv composer.json~ composer.json
# create the zip archiev from the files in the repository
git ls-files | xargs zip "$pct_filename"
# and push it to Gitea
curl --user $auth \
--upload-file "$pct_filename" \
"https://$server/api/packages/$owner/composer?version=$pct_version"

View File

@@ -0,0 +1,11 @@
name: composer
run-name: Publishing composer package to repository
on: [ tag ]
jobs:
zip-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: publish composer package
run: ./.gitea/composer-gitea-publish dev.noccylabs.info logdb ${{ secrets.AUTH }}