create tag automaticly
This commit is contained in:
1 parent
71324e52c2
commit
f73660b09f
1 file changed
+37
@@ -20,6 +20,43 @@ jobs:
|
||||
mv PsalmTafel/* . 2>/dev/null || mv psalmtafel/* . 2>/dev/null || mv */* . 2>/dev/null
|
||||
rm repo.zip
|
||||
|
||||
- name: Create tag in Gitea (based on package.json version)
|
||||
run: |
|
||||
apk add --no-cache jq curl
|
||||
|
||||
VERSION=$(jq -r '.version' package.json)
|
||||
TAG="v${VERSION}"
|
||||
echo "Tag: $TAG"
|
||||
|
||||
# Hole commit SHA von main (damit Tag korrekt gesetzt wird)
|
||||
SHA=$(curl -s \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
"http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/branches/main" \
|
||||
| jq -r '.commit.id')
|
||||
|
||||
echo "main commit SHA: $SHA"
|
||||
|
||||
# Prüfen, ob Tag 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 }}/repository/tags/${TAG}")
|
||||
|
||||
if [ "$HTTP_STATUS" -eq 404 ]; then
|
||||
echo "Tag $TAG existiert nicht. Erstelle ihn..."
|
||||
# Gitea: Tag erstellen via /git/refs
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"ref\": \"refs/tags/${TAG}\",
|
||||
\"sha\": \"${SHA}\"
|
||||
}" \
|
||||
"http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/git/refs"
|
||||
else
|
||||
echo "Tag $TAG existiert bereits. Überspringe Erstellung."
|
||||
fi
|
||||
|
||||
|
||||
- name: Update Docker container
|
||||
run: |
|
||||
echo "Building new Next.js Docker image..."
|
||||
|
||||
Reference in new issue
Block a user