Compare commits
11 Commits
7f5bf677d4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 07d4f8f46e | |||
|
|
50ff7c93b4 | ||
| 3857479277 | |||
|
|
7ab82e7655 | ||
| aa1c0543fc | |||
|
|
e5d39d88ea | ||
| f6a15bd9e6 | |||
|
|
c3326dde88 | ||
| 5f1c24495c | |||
| 51179a1614 | |||
| 59cbb45f1f |
@@ -12,63 +12,125 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Tools installieren
|
- name: Tools installieren
|
||||||
run: |
|
run: |
|
||||||
|
set -e
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y git zip curl jq rsync
|
apt-get install -y git zip curl jq rsync
|
||||||
|
|
||||||
|
- name: Variablen setzen
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
echo "REPO=${{ gitea.repository }}" >> "$GITHUB_ENV"
|
||||||
|
echo "TAG=${{ gitea.ref_name }}" >> "$GITHUB_ENV"
|
||||||
|
echo "SERVER_URL=https://git.local.unique-studios.de" >> "$GITHUB_ENV"
|
||||||
|
echo "API_BASE=https://git.local.unique-studios.de/api/v1" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Repo klonen
|
- name: Repo klonen
|
||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/repo /tmp/build
|
set -e
|
||||||
git clone http://oauth2:${{ secrets.PAT_TOKEN }}@10.10.2.140:3000/Torsten/HailMaryGuildTools.git /tmp/repo
|
rm -rf /tmp/repo /tmp/build /tmp/release.json /tmp/assets.json
|
||||||
|
|
||||||
|
git clone "https://oauth2:${{ secrets.PAT_TOKEN }}@git.local.unique-studios.de/${REPO}.git" /tmp/repo
|
||||||
|
|
||||||
- name: ZIP mit Addon-Ordner bauen
|
- name: ZIP mit Addon-Ordner bauen
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
mkdir -p /tmp/build/HailMaryGuildTools
|
|
||||||
|
REPO_NAME="${REPO##*/}"
|
||||||
|
|
||||||
|
mkdir -p "/tmp/build/${REPO_NAME}"
|
||||||
|
|
||||||
rsync -a \
|
rsync -a \
|
||||||
--exclude='.git' \
|
--exclude='.git' \
|
||||||
--exclude='.gitea' \
|
--exclude='.gitea' \
|
||||||
/tmp/repo/ /tmp/build/HailMaryGuildTools/
|
/tmp/repo/ "/tmp/build/${REPO_NAME}/"
|
||||||
|
|
||||||
cd /tmp/build
|
cd /tmp/build
|
||||||
zip -r "/tmp/HailMaryGuildTools-${{ gitea.ref_name }}.zip" HailMaryGuildTools
|
zip -r "/tmp/${REPO_NAME}-${TAG}.zip" "${REPO_NAME}"
|
||||||
ls -lh "/tmp/HailMaryGuildTools-${{ gitea.ref_name }}.zip"
|
ls -lh "/tmp/${REPO_NAME}-${TAG}.zip"
|
||||||
|
|
||||||
- name: Release anlegen oder laden
|
- name: Release anlegen oder laden
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
TAG="${{ gitea.ref_name }}"
|
|
||||||
API="http://10.10.2.140:3000/api/v1/repos/Torsten/HailMaryGuildTools"
|
API="${API_BASE}/repos/${REPO}"
|
||||||
|
REPO_NAME="${REPO##*/}"
|
||||||
|
|
||||||
|
echo "Server: ${SERVER_URL}"
|
||||||
|
echo "Repo: ${REPO}"
|
||||||
|
echo "Tag: ${TAG}"
|
||||||
|
|
||||||
HTTP_CODE=$(curl -s -o /tmp/release.json -w "%{http_code}" \
|
HTTP_CODE=$(curl -s -o /tmp/release.json -w "%{http_code}" \
|
||||||
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
|
||||||
"$API/releases/tags/$TAG")
|
-H "Accept: application/json" \
|
||||||
|
"${API}/releases/tags/${TAG}")
|
||||||
|
|
||||||
if [ "$HTTP_CODE" = "200" ]; then
|
if [ "$HTTP_CODE" = "200" ]; then
|
||||||
echo "Release existiert bereits."
|
echo "Release existiert bereits."
|
||||||
else
|
elif [ "$HTTP_CODE" = "404" ]; then
|
||||||
echo "Release wird erstellt."
|
echo "Release wird erstellt."
|
||||||
curl --fail -s \
|
curl --fail -s \
|
||||||
|
-X POST \
|
||||||
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
|
||||||
|
-H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{
|
-d "{
|
||||||
\"tag_name\": \"$TAG\",
|
\"tag_name\": \"${TAG}\",
|
||||||
\"name\": \"HailMaryGuildTools $TAG\",
|
\"name\": \"${REPO_NAME} ${TAG}\",
|
||||||
\"draft\": false,
|
\"draft\": false,
|
||||||
\"prerelease\": false
|
\"prerelease\": false
|
||||||
}" \
|
}" \
|
||||||
"$API/releases" > /tmp/release.json
|
"${API}/releases" > /tmp/release.json
|
||||||
|
else
|
||||||
|
echo "Unerwarteter HTTP-Code beim Laden des Releases: ${HTTP_CODE}"
|
||||||
|
cat /tmp/release.json || true
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Release-Daten:"
|
||||||
jq '.id, .tag_name, .html_url' /tmp/release.json
|
jq '.id, .tag_name, .html_url' /tmp/release.json
|
||||||
|
|
||||||
|
- name: Vorhandenes Asset mit gleichem Namen löschen
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
RELEASE_ID=$(jq -r '.id' /tmp/release.json)
|
||||||
|
REPO_NAME="${REPO##*/}"
|
||||||
|
FILE_NAME="${REPO_NAME}-${TAG}.zip"
|
||||||
|
ASSET_API="${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets"
|
||||||
|
|
||||||
|
curl --fail -s \
|
||||||
|
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
|
||||||
|
-H "Accept: application/json" \
|
||||||
|
"${ASSET_API}" > /tmp/assets.json
|
||||||
|
|
||||||
|
ASSET_ID=$(jq -r ".[] | select(.name == \"${FILE_NAME}\") | .id" /tmp/assets.json | head -n1)
|
||||||
|
|
||||||
|
if [ -n "$ASSET_ID" ] && [ "$ASSET_ID" != "null" ]; then
|
||||||
|
echo "Vorhandenes Asset gefunden: ${ASSET_ID} -> wird gelöscht"
|
||||||
|
curl --fail -s \
|
||||||
|
-X DELETE \
|
||||||
|
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
|
||||||
|
-H "Accept: application/json" \
|
||||||
|
"${ASSET_API}/${ASSET_ID}"
|
||||||
|
else
|
||||||
|
echo "Kein vorhandenes Asset mit gleichem Namen gefunden."
|
||||||
|
fi
|
||||||
|
|
||||||
- name: ZIP an Release anhängen
|
- name: ZIP an Release anhängen
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
RELEASE_ID=$(jq -r '.id' /tmp/release.json)
|
|
||||||
FILE="/tmp/HailMaryGuildTools-${{ gitea.ref_name }}.zip"
|
|
||||||
|
|
||||||
curl --fail \
|
RELEASE_ID=$(jq -r '.id' /tmp/release.json)
|
||||||
|
REPO_NAME="${REPO##*/}"
|
||||||
|
FILE="/tmp/${REPO_NAME}-${TAG}.zip"
|
||||||
|
FILE_NAME="$(basename "$FILE")"
|
||||||
|
UPLOAD_URL="${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILE_NAME}"
|
||||||
|
|
||||||
|
echo "Upload URL: ${UPLOAD_URL}"
|
||||||
|
|
||||||
|
curl --fail -v \
|
||||||
|
-X POST \
|
||||||
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
|
||||||
|
-H "Accept: application/json" \
|
||||||
-F "attachment=@${FILE}" \
|
-F "attachment=@${FILE}" \
|
||||||
"http://10.10.2.140:3000/api/v1/repos/Torsten/HailMaryGuildTools/releases/${RELEASE_ID}/assets?name=$(basename "$FILE")"
|
"${UPLOAD_URL}"
|
||||||
@@ -5,8 +5,8 @@ It combines cooldown tracking, encounter reminders, notes, and map utilities in
|
|||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
- Stable version: `1.3`
|
- Stable version: `2.0.0`
|
||||||
- Current build: `2.0-beta`
|
- Current build: `2.1.0-beta`
|
||||||
- SavedVariables: `HailMaryGuildToolsDB`
|
- SavedVariables: `HailMaryGuildToolsDB`
|
||||||
|
|
||||||
## Main Features
|
## Main Features
|
||||||
|
|||||||
Reference in New Issue
Block a user