3
0

Compare commits

52 Commits

Author SHA1 Message Date
Michael Otto
9bed9acf63 alten plugin Eintrag entfernen gefixt 2026-03-19 08:15:44 +01:00
Michael Otto
f8a9fb5296 alten plugin Eintrag entfernen gefixt 2026-03-19 08:11:27 +01:00
Michael Otto
1fb14d9a20 changelog escaped gefixt 2026-03-19 08:05:17 +01:00
Michael Otto
ed417e2324 changelog escaped gefixt 2026-03-19 08:01:23 +01:00
Michael Otto
20b8e2a2a0 changelog escaped gefixt 2026-03-19 07:57:35 +01:00
Michael Otto
167b9dfc64 changelog escaped gefixt 2026-03-19 07:42:39 +01:00
Michael Otto
4835be5bed changelog escaped gefixt 2026-03-19 07:37:04 +01:00
Michael Otto
cb12cd7d84 changelog escaped gefixt 2026-03-19 07:32:18 +01:00
fced948b1e .gitea/workflows/release.yaml aktualisiert 2026-03-19 07:28:09 +01:00
Michael Otto
d5ffff5383 changelog escaped gefixt 2026-03-19 07:22:18 +01:00
Michael Otto
075579174e changelog escaped 2026-03-19 07:18:35 +01:00
Michael Otto
b7c0b64f8c Add changelog in reöease.yaml 2026-03-19 06:20:22 +01:00
Michael Otto
8904fb24cc gitea actions ng53 2026-03-18 14:49:51 +01:00
Michael Otto
3359596693 gitea actions ng52 2026-03-18 14:40:13 +01:00
Michael Otto
24c5879aaf gitea actions ng51 2026-03-18 14:26:09 +01:00
Michael Otto
19116b5d24 gitea actions ng50 2026-03-18 14:10:08 +01:00
Michael Otto
16e6319125 gitea actions ng49 2026-03-18 14:05:51 +01:00
Michael Otto
bf2890f318 gitea actions ng48 2026-03-18 14:03:22 +01:00
Michael Otto
0ce4b8e181 gitea actions ng47 2026-03-18 14:01:43 +01:00
Michael Otto
57ed4a0c83 gitea actions ng46 2026-03-18 13:57:36 +01:00
Michael Otto
fd8d7644d4 gitea actions ng45 2026-03-18 13:56:20 +01:00
Michael Otto
883b4ed327 gitea actions ng44 2026-03-18 13:53:20 +01:00
Michael Otto
1dbc7cde09 gitea actions ng43 2026-03-18 13:52:19 +01:00
Michael Otto
6f13b8f240 gitea actions ng42 2026-03-18 13:47:06 +01:00
Michael Otto
efe8f297d4 gitea actions ng41 2026-03-18 13:40:06 +01:00
Michael Otto
d872fc0d2a gitea actions ng40 2026-03-18 13:39:10 +01:00
Michael Otto
9dbc0bd2f0 gitea actions ng39 2026-03-18 13:37:52 +01:00
Michael Otto
8d4ab652a2 gitea actions ng38 2026-03-18 13:35:26 +01:00
Michael Otto
d0c2f43075 gitea actions ng37 2026-03-18 13:26:00 +01:00
Michael Otto
8c31def8e4 gitea actions ng36 2026-03-18 13:19:34 +01:00
Michael Otto
5342cd9bef gitea actions ng35 2026-03-18 07:57:26 +01:00
Michael Otto
a91fb68276 gitea actions ng34 2026-03-18 07:40:52 +01:00
Michael Otto
96fedd70ab gitea actions ng33 2026-03-18 07:39:06 +01:00
Michael Otto
1020929511 gitea actions ng32 2026-03-18 07:01:37 +01:00
Michael Otto
541261a15a gitea actions ng31 2026-03-18 06:57:43 +01:00
Michael Otto
d44900afd7 gitea actions ng30 2026-03-18 06:52:02 +01:00
Michael Otto
977466a026 gitea actions ng29 2026-03-18 06:47:41 +01:00
Michael Otto
ec0ae4d54d gitea actions ng28 2026-03-18 06:16:22 +01:00
Michael Otto
8d9f9ac251 gitea actions ng27 2026-03-18 06:13:34 +01:00
Michael Otto
8abf18165d gitea actions ng26 2026-03-18 06:10:13 +01:00
Michael Otto
a576bbe638 gitea actions ng25 2026-03-17 15:13:02 +01:00
Michael Otto
653cbb59f8 gitea actions ng24 2026-03-17 15:12:05 +01:00
Michael Otto
d92b86020f gitea actions ng23 2026-03-17 15:08:28 +01:00
Michael Otto
d83192e9cf gitea actions ng22 2026-03-17 15:05:41 +01:00
Michael Otto
fd2fd505c5 gitea actions ng21 2026-03-17 14:59:58 +01:00
Michael Otto
24b3b75837 gitea actions ng20 2026-03-17 14:59:09 +01:00
Michael Otto
14e6ec381d gitea actions ng19 2026-03-17 14:58:01 +01:00
Michael Otto
2a2bde07bf gitea actions ng18 2026-03-17 14:57:10 +01:00
Michael Otto
428fa3e2a5 gitea actions ng17 2026-03-17 14:52:20 +01:00
Michael Otto
d313473a5d gitea actions ng16 2026-03-17 14:47:57 +01:00
Michael Otto
249efca913 gitea actions ng15 2026-03-17 14:27:18 +01:00
Michael Otto
860f041837 gitea actions ng14 2026-03-17 14:25:08 +01:00

View File

@@ -25,31 +25,53 @@ jobs:
- name: Abhängigkeiten installieren
shell: sh
run: |
apk add --no-cache bash jq git rsync zip
apk add --no-cache bash jq git rsync zip curl python3
- name: Daten zusammenstellen
id: daten
run: |
DECODED=$(echo "${{ github.event.inputs.payload }}" | base64 -d)
echo "version=$(echo "$DECODED" | jq -r '.version')" >> $GITHUB_OUTPUT
echo "channel=$(echo "$DECODED" | jq -r '.channel')" >> $GITHUB_OUTPUT
echo "prerelease=$(echo "$DECODED" | jq -r '.prerelease')" >> $GITHUB_OUTPUT
echo "zip_folder=$(echo "$DECODED" | jq -r '.zip_folder')" >> $GITHUB_OUTPUT
# Werte aus Payload auslesen
NAME=$(echo "$DECODED" | jq -r '.name')
GROUP=$(echo "$DECODED" | jq -r '.group')
VERSION=$(echo "$DECODED" | jq -r '.version')
CHANNEL=$(echo "$DECODED" | jq -r '.channel')
PRERELEASE=$(echo "$DECODED" | jq -r '.prerelease')
ZIP_FOLDER=$(echo "$DECODED" | jq -r '.zip_folder')
ZIP_FILE=$(echo "$DECODED" | jq -r '.zip_file')
TAG=$(echo "$DECODED" | jq -r '.tag')
ID=$(echo "$DECODED" | jq -r '.zip_folder')
echo "version=$(echo "$DECODED" | jq -r '.version')"
echo "channel=$(echo "$DECODED" | jq -r '.channel')"
echo "prerelease=$(echo "$DECODED" | jq -r '.prerelease')"
echo "zip_folder=$(echo "$DECODED" | jq -r '.zip_folder')"
# Outputs setzen
echo "name=$NAME" >> $GITHUB_OUTPUT
echo "group=$GROUP" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "channel=$CHANNEL" >> $GITHUB_OUTPUT
echo "prerelease=$PRERELEASE" >> $GITHUB_OUTPUT
echo "zip_folder=$ZIP_FOLDER" >> $GITHUB_OUTPUT
echo "zip_file=$ZIP_FILE" >> $GITHUB_OUTPUT
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "id=$ID" >> $GITHUB_OUTPUT
# Debug-Ausgabe
echo "name=$NAME"
echo "group=$GROUP"
echo "version=$VERSION"
echo "channel=$CHANNEL"
echo "prerelease=$PRERELEASE"
echo "zip_folder=$ZIP_FOLDER"
echo "zip_file=$ZIP_FILE"
echo "tag=$TAG"
echo "id=$ID"
GIT_REPO_URL="https://${RELEASE_TOKEN}:x-oauth-basic@${{ vars.RELEASE_URL }}/${GITHUB_REPOSITORY}.git"
echo "git_repo_url=$GIT_REPO_URL" >> $GITHUB_OUTPUT
echo "git_repo_url=$GIT_REPO_URL"
PAYLOAD_REPO=$(echo "$DECODED" | jq -r '.git_url')
PAYLOAD_REPO="${GROUP}/${NAME}"
echo $PAYLOAD_REPO
GIT_PLUGIN_URL="https://${RELEASE_TOKEN}:x-oauth-basic@${{ vars.RELEASE_URL }}/$PAYLOAD_REPO.git"
echo "git_plugin_url=$GIT_PLUGIN_URL" >> $GITHUB_OUTPUT
echo "git_plugin_url=$GIT_PLUGIN_URL"
- name: Repositorys klonen
run: |
@@ -68,25 +90,24 @@ jobs:
- name: Metadata anpassen
run: |
cd plugin
INI_FILE="metadata.txt"
# version setzen
sed -i "s/^version=.*/version=$VERSION/" "$INI_FILE"
# experimental setzen
sed -i "s/^version=.*/version=$VERSION-$CHANNEL/" "$FILE"
if [ "$PRERELEASE" = "true" ]; then
sed -i "s/^experimental=.*/experimental=true/" "$INI_FILE"
sed -i "s/^experimental=.*/experimental=true/" "$FILE"
else
sed -i "s/^experimental=.*/experimental=false/" "$INI_FILE"
sed -i "s/^experimental=.*/experimental=false/" "$FILE"
fi
# channel im repository ersetzen
sed -i "s|^\(repository=.*src/branch/\).*|\1$CHANNEL/|" "$INI_FILE"
sed -i "s|^\(repository=.*src/branch/\).*|\1$CHANNEL/|" "$FILE"
# Debug: Ausgabe der Datei
echo "== Inhalt der angepassten INI-Datei =="
cat "$INI_FILE"
cat "$FILE"
env:
FILE: "metadata.txt"
VERSION: ${{ steps.daten.outputs.version }}
PRERELEASE: ${{ steps.daten.outputs.prerelease }}
CHANNEL: ${{ steps.daten.outputs.channel }}
@@ -94,18 +115,298 @@ jobs:
- name: ZIP-Datei erstellen
id: zip
run: |
mkdir -p zip
mkdir -p ${ZIP_FOLDER}
rsync -a \
--exclude='.git' \
--exclude='.gitea' \
--exclude='.gitignore' \
--exclude='plugin.cfg' \
--exclude='*/__pycache__/*' \
./plugin/ ./zip/${ZIP_FOLDER}/
./plugin/ ./${ZIP_FOLDER}/
ls -la zip/${ZIP_FOLDER}/
ls -la ${ZIP_FOLDER}/
zip -r "${ZIP_FILE}" "${ZIP_FOLDER}/"
ls -la
env:
ZIP_FOLDER: ${{ steps.daten.outputs.zip_folder }}
ZIP_FILE: ${{ steps.daten.outputs.zip_folder }}.zip
ZIP_FILE: ${{ steps.daten.outputs.zip_file }}
- name: Changelog einlesen
id: changelog
run: |
cd plugin
# Aktueller Block = alles vor dem ersten ---
CURRENT=$(awk '/^---/{exit} {print}' changelog.txt)
# Vollständige Historie = alles nach dem ersten ---
HISTORY=$(awk 'found{print} /^---/{found=1}' changelog.txt)
# Gitea Release Body zusammenbauen
VERSION="${{ steps.releaseinfo.outputs.version }}"
FULL=$(printf "## %s\n%s\n\n%s" "$VERSION" "$CURRENT" "$HISTORY")
echo "DEBUG | Aktueller Changelog:"
echo "$CURRENT"
# Für GITHUB_OUTPUT: Multiline via EOF-Marker
echo "current<<EOF" >> $GITHUB_OUTPUT
echo "$CURRENT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "full<<EOF" >> $GITHUB_OUTPUT
echo "$FULL" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Gitea-Release erstellen
id: create_release
run: |
API_URL="https://${{ vars.RELEASE_URL }}/api/v1/repos/${PLUGIN_GROUP}/${PLUGIN_NAME}/releases"
JSON=$(jq -n \
--arg tag "$VERSION-$CHANNEL" \
--arg name "Version $VERSION-$CHANNEL" \
--arg body "$BODY" \
--argjson prerelease "$PRERELEASE" \
'{tag_name: $tag, name: $name, body: $body, prerelease: $prerelease}')
API_RESPONSE=$(curl -s -X POST "$API_URL" \
-H "accept: application/json" \
-H "Authorization: token $RELEASE_TOKEN" \
-H "Content-Type: application/json" \
-d "$JSON")
RELEASE_ID=$(echo "$API_RESPONSE" | jq -r '.id')
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
echo "Fehler beim Erstellen des Releases!"
echo "$API_RESPONSE"
exit 1
fi
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
env:
PRERELEASE: ${{ steps.daten.outputs.prerelease }}
BODY: ${{ steps.changelog.outputs.current }}
VERSION: ${{ steps.daten.outputs.version }}
TAG: ${{ steps.daten.outputs.tag }}
PLUGIN_NAME: ${{ steps.daten.outputs.name }}
PLUGIN_GROUP: ${{ steps.daten.outputs.group }}
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
CHANNEL: ${{ steps.daten.outputs.channel }}
- name: ZIP-Datei hochladen
run: |
pwd
ls -la
echo @${ZIP_FILE}
API_URL="https://${{ vars.RELEASE_URL }}/api/v1/repos/${PLUGIN_GROUP}/${PLUGIN_NAME}/releases/${RELEASE_ID}/assets?name=${ZIP_FILE}"
curl -sf -X POST "$API_URL" \
-H "Authorization: token $RELEASE_TOKEN" \
-H "Content-Type: application/zip" \
--data-binary "@${ZIP_FILE}" \
-o upload_response.json
if jq -e '.id' upload_response.json >/dev/null 2>&1; then
echo "ZIP erfolgreich hochgeladen."
else
echo "Fehler beim Hochladen der ZIP!"
cat upload_response.json
exit 1
fi
env:
RELEASE_ID: ${{ steps.create_release.outputs.release_id }}
ZIP_FILE: ${{ steps.daten.outputs.zip_file }}
PLUGIN_NAME: ${{ steps.daten.outputs.name }}
PLUGIN_GROUP: ${{ steps.daten.outputs.group }}
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Changelog aktualisieren
run: |
cd plugin
TMP_FILE=$(mktemp)
{
echo "---"
echo "Version $VERSION-$CHANNEL:"
cat "$FILE"
} > "$TMP_FILE"
mv "$TMP_FILE" "$FILE"
# Debug
echo "== Neuer Inhalt von changelog.txt =="
head -n 5 "$FILE"
cd ~
pwd
env:
FILE: "changelog.txt"
VERSION: ${{ steps.daten.outputs.version }}
CHANNEL: ${{ steps.daten.outputs.channel }}
- name: Repository aktualisieren
run: |
cd plugin
git config user.name "release-bot"
git config user.email "ci@example.local"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Lösche alten lokalen Tag $TAG"
git tag -d "$TAG"
echo "Lösche alten Remote-Tag $TAG"
git -c http.extraheader="AUTHORIZATION: bearer $RELEASE_TOKEN" push origin :refs/tags/"$TAG"
else
echo "Tag $TAG nicht vorhanden"
fi
git add metadata.txt changelog.txt
git commit -m "Release $VERSION-$CHANNEL"
git -c http.extraheader="AUTHORIZATION: bearer $RELEASE_TOKEN" push origin HEAD:"$CHANNEL"
env:
CHANNEL: ${{ steps.daten.outputs.channel }}
VERSION: ${{ steps.daten.outputs.version }}
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
TAG: ${{ steps.daten.outputs.tag }}
- name: XML-Datei bestimmen
id: xmlfile
run: |
case "${{ steps.daten.outputs.channel }}" in
stable) FILE="plugins.xml" ;;
testing) FILE="plugins-testing.xml" ;;
unstable) FILE="plugins-unstable.xml" ;;
esac
echo "file=$FILE" >> $GITHUB_OUTPUT
- name: XML-Datei initialisieren
run: |
cd repo
FILE="${{ steps.xmlfile.outputs.file }}"
if [ ! -s "$FILE" ]; then
echo "<plugins></plugins>" > "$FILE"
fi
- name: Alten Plugin-Eintrag entfernen
run: |
cd repo
FILE="${{ steps.xmlfile.outputs.file }}"
ID="${{ steps.daten.outputs.id }}"
# Entfernt den kompletten Plugin-Block
sed -i "/<pyqgis_plugin[^>]*plugin_id=\"${ID//\//\\/}\"/,/<\/pyqgis_plugin>/d" "$FILE"
- name: metadata.txt einlesen
id: metadata
run: |
cd plugin
while read -r line || [ -n "$line" ]; do
key="${line%%=*}"
value="${line#*=}"
echo "$key=$value" >> $GITHUB_OUTPUT
echo "$key=$value"
done < $FILE
env:
FILE: "metadata.txt"
- name: Template anwenden und neue XML erzeugen
run: |
cd repo
FILE="${{ steps.xmlfile.outputs.file }}"
git fetch origin hidden/templates
git checkout origin/hidden/templates -- plugin.template
TEMPLATE="plugin.template"
cat "$TEMPLATE"
# Template laden
ENTRY=$(cat "$TEMPLATE")
ENTRY="${ENTRY//\{\{NAME\}\}/${{ steps.metadata.outputs.name }}}"
ENTRY="${ENTRY//\{\{QGIS_MIN\}\}/${{ steps.metadata.outputs.qgisMinimumVersion }}}"
ENTRY="${ENTRY//\{\{QGIS_MAX\}\}/${{ steps.metadata.outputs.qgisMaximumVersion }}}"
ENTRY="${ENTRY//\{\{DESCRIPTION\}\}/${{ steps.metadata.outputs.description }}}"
ENTRY="${ENTRY//\{\{VERSION\}\}/${{ steps.metadata.outputs.version }}}"
ENTRY="${ENTRY//\{\{AUTHOR\}\}/${{ steps.metadata.outputs.author }}}"
ENTRY="${ENTRY//\{\{EMAIL\}\}/${{ steps.metadata.outputs.email }}}"
ENTRY="${ENTRY//\{\{HOMEPAGE\}\}/${{ steps.metadata.outputs.homepage }}}"
ENTRY="${ENTRY//\{\{TRACKER\}\}/${{ steps.metadata.outputs.tracker }}}"
ENTRY="${ENTRY//\{\{REPOSITORY\}\}/${{ steps.metadata.outputs.repository }}}"
ENTRY="${ENTRY//\{\{EXPERIMENTAL\}\}/${{ steps.metadata.outputs.experimental }}}"
ENTRY="${ENTRY//\{\{DEPRECATED\}\}/${{ steps.metadata.outputs.deprecated }}}"
ENTRY="${ENTRY//\{\{ID\}\}/${{ steps.daten.outputs.id }}}"
URL=${{ steps.metadata.outputs.homepage }}/releases/download/${{ steps.daten.outputs.version }}-${{ steps.daten.outputs.channel }}/${{ steps.daten.outputs.zip_file }}
ENTRY="${ENTRY//\{\{URL\}\}/$URL}"
export CHANGELOG="${{ steps.changelog.outputs.current }}"
export ENTRY="$ENTRY"
ENTRY=$(python3 - <<'EOF'
import os
changelog = os.environ.get("CHANGELOG", "")
entry = os.environ.get("ENTRY", "")
changelog = changelog.replace("&", "&amp;")
changelog = changelog.replace("<", "&lt;")
changelog = changelog.replace(">", "&gt;")
lines = changelog.splitlines()
changelog_clean = "&#10;".join(line for line in lines if line.strip())
result = entry.replace("{{CHANGELOG}}", changelog_clean)
print(result, end="")
EOF
)
echo "$ENTRY"
# Neue Datei erzeugen
{
# Alles vor </plugins>
sed '/<\/plugins>/d' "$FILE"
# Neuen Eintrag einfügen
printf "%s\n" "$ENTRY"
# </plugins> wieder anhängen
echo "</plugins>"
} > new.xml
mv new.xml "$FILE"
rm $TEMPLATE
- name: Commit & Push
run: |
cd repo
git config user.name "release-bot"
git config user.email "ci@example.local"
git add .
# Commit nur, wenn Änderungen vorhanden sind
if ! git diff --cached --quiet; then
git commit -m "${{ inputs.name }} ${{ steps.metadata.outputs.version }}"
else
echo "Keine Änderungen kein Commit notwendig."
exit 0
fi
# Token in die URL einbauen
git remote set-url origin "https://${{ secrets.RELEASE_TOKEN }}:@${{ vars.RELEASE_URL }}/AG_QGIS/Repository.git"
git push origin main