forked from AG_QGIS/Plugin_SN_Basis
65 lines
2.4 KiB
YAML
65 lines
2.4 KiB
YAML
name: Automatisches Release mit ZIP-Archiv
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
Build-Release:
|
|
runs-on: alpine-latest
|
|
defaults:
|
|
run:
|
|
shell: sh
|
|
|
|
steps:
|
|
- name: Vorbereitung und Tools installieren
|
|
run: |
|
|
apk add --no-cache git zip curl jq
|
|
git config --global http.sslVerify false
|
|
|
|
- name: Code auschecken (Über externe Domain)
|
|
run: |
|
|
git clone --depth 1 --branch ${{ github.ref_name }} https://x-access-token:${{ gitea.token }}@entwicklung.flurneuordnung-sachsen.de/${{ github.repository }}.git .
|
|
|
|
- name: ZIP-Archiv erstellen
|
|
run: |
|
|
echo "Erstelle ZIP-Datei für Version ${{ github.ref_name }}..."
|
|
zip -r release_${{ github.ref_name }}.zip . -x "*.git*"
|
|
ls -la *.zip
|
|
|
|
- name: Neues Release in Gitea anlegen
|
|
run: |
|
|
echo "Kommuniziere mit Gitea API über HTTPS..."
|
|
API_RESPONSE=$(curl -s -k -X POST "https://entwicklung.flurneuordnung-sachsen.de/api/v1/repos/${{ github.repository }}/releases" \
|
|
-H "accept: application/json" \
|
|
-H "Authorization: token ${{ gitea.token }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"body": "Dieses Release wurde automatisch vom Gitea Runner erstellt.",
|
|
"draft": false,
|
|
"name": "Version ${{ github.ref_name }}",
|
|
"prerelease": false,
|
|
"tag_name": "${{ github.ref_name }}"
|
|
}')
|
|
|
|
RELEASE_ID=$(echo $API_RESPONSE | jq -r '.id')
|
|
|
|
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
|
|
echo "Fehler beim Erstellen des Releases. API Antwort:"
|
|
echo $API_RESPONSE
|
|
exit 1
|
|
fi
|
|
|
|
echo "Release ID: $RELEASE_ID"
|
|
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
|
|
|
|
- name: ZIP-Archiv an das Release anhängen
|
|
run: |
|
|
echo "Lade release_${{ github.ref_name }}.zip hoch..."
|
|
curl -s -k -X POST "https://entwicklung.flurneuordnung-sachsen.de/api/v1/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}/assets?name=release_${{ github.ref_name }}.zip" \
|
|
-H "accept: application/json" \
|
|
-H "Authorization: token ${{ gitea.token }}" \
|
|
-H "Content-Type: multipart/form-data" \
|
|
-F "attachment=@release_${{ github.ref_name }}.zip"
|
|
|
|
echo "✅ Upload abgeschlossen!" |