111 lines
3.7 KiB
YAML
111 lines
3.7 KiB
YAML
name: Release Plugin
|
|
run-name: "Release | ${{ inputs.name }} → ${{ inputs.tag }}"
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
payload:
|
|
description: 'Base64-kodierter JSON-Payload'
|
|
required: true
|
|
name:
|
|
description: 'Plugin Name'
|
|
required: true
|
|
tag:
|
|
description: 'Release Tag'
|
|
required: true
|
|
|
|
jobs:
|
|
release-plugin:
|
|
runs-on: alpine-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
steps:
|
|
- name: Abhängigkeiten installieren
|
|
shell: sh
|
|
run: |
|
|
apk add --no-cache bash jq git rsync zip
|
|
|
|
- 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
|
|
|
|
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')"
|
|
|
|
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')
|
|
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: |
|
|
git clone "$GIT_REPO_URL" repo
|
|
git clone "$GIT_PLUGIN_URL" plugin
|
|
cd plugin
|
|
git checkout "$CHANNEL"
|
|
cd ..
|
|
|
|
env:
|
|
CHANNEL: ${{ steps.daten.outputs.channel }}
|
|
GIT_REPO_URL: ${{ steps.daten.outputs.git_repo_url }}
|
|
GIT_PLUGIN_URL: ${{ steps.daten.outputs.git_plugin_url }}
|
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
|
|
- name: Metadata anpassen
|
|
run: |
|
|
cd plugin
|
|
INI_FILE="metadata.txt"
|
|
# version setzen
|
|
sed -i "s/^version=.*/version=$VERSION/" "$INI_FILE"
|
|
|
|
# experimental setzen
|
|
if [ "$PRERELEASE" = "true" ]; then
|
|
sed -i "s/^experimental=.*/experimental=true/" "$INI_FILE"
|
|
else
|
|
sed -i "s/^experimental=.*/experimental=false/" "$INI_FILE"
|
|
fi
|
|
|
|
# channel im repository ersetzen
|
|
sed -i "s|^\(repository=.*src/branch/\).*|\1$CHANNEL/|" "$INI_FILE"
|
|
|
|
# Debug: Ausgabe der Datei
|
|
echo "== Inhalt der angepassten INI-Datei =="
|
|
cat "$INI_FILE"
|
|
|
|
env:
|
|
VERSION: ${{ steps.daten.outputs.version }}
|
|
PRERELEASE: ${{ steps.daten.outputs.prerelease }}
|
|
CHANNEL: ${{ steps.daten.outputs.channel }}
|
|
|
|
- name: ZIP-Datei erstellen
|
|
id: zip
|
|
run: |
|
|
mkdir -p zip
|
|
|
|
rsync -a \
|
|
--exclude='.git' \
|
|
--exclude='.gitea' \
|
|
--exclude='.gitignore' \
|
|
--exclude='plugin.cfg' \
|
|
--exclude='*/__pycache__/*' \
|
|
./plugin/ ./zip/${ZIP_FOLDER}/
|
|
|
|
ls -la zip/${ZIP_FOLDER}/
|
|
|
|
env:
|
|
ZIP_FOLDER: ${{ steps.daten.outputs.zip_folder }}
|
|
ZIP_FILE: ${{ steps.daten.outputs.zip_folder }}.zip |