This commit is contained in:
1 parent
47375c6b9f
commit
c32189e8aa
1 file changed
+30
-1
@@ -36,4 +36,33 @@ jobs:
|
||||
--name psalmtafel-container \
|
||||
-p 8443:3000 \
|
||||
--restart always \
|
||||
psalmtafel-app
|
||||
psalmtafel-app
|
||||
- name: Release in Gitea erstellen
|
||||
run: |
|
||||
# 1. Version aus package.json auslesen
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
echo "Aktuelle Version: v$VERSION"
|
||||
|
||||
# 2. Prüfen, ob das Release/Tag bereits existiert
|
||||
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
"http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/releases/tags/v$VERSION")
|
||||
|
||||
# 3. Wenn Release noch nicht existiert (404), erstelle es
|
||||
if [ "$HTTP_STATUS" -eq 404 ]; then
|
||||
echo "Erstelle neues Release v$VERSION..."
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"tag_name\": \"v$VERSION\",
|
||||
\"target_commitish\": \"main\",
|
||||
\"name\": \"Release v$VERSION\",
|
||||
\"body\": \"Automatisches Release für Version v$VERSION\",
|
||||
\"draft\": false,
|
||||
\"prerelease\": false
|
||||
}" \
|
||||
"http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/releases"
|
||||
else
|
||||
echo "Release v$VERSION existiert bereits. Überspringe Erstellung."
|
||||
fi
|
||||
Reference in new issue
Block a user