Merge pull request 'refactor: updated deplay.yaml action' (#34) from small-fixes into main
Deploy Next.js via Docker / deploy (push) Successful in 39s

Reviewed-on: Schanbro/PsalmTafel#34
This commit was merged in pull request #34.
This commit is contained in:
robin committed 2026-07-31 12:43:58 +00:00
commit ff339fd8e8
1 file changed
+16 -39
+16 -39
View File
@@ -20,43 +20,6 @@ jobs:
mv PsalmTafel/* . 2>/dev/null || mv psalmtafel/* . 2>/dev/null || mv */* . 2>/dev/null mv PsalmTafel/* . 2>/dev/null || mv psalmtafel/* . 2>/dev/null || mv */* . 2>/dev/null
rm repo.zip 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 - name: Update Docker container
run: | run: |
echo "Building new Next.js Docker image..." echo "Building new Next.js Docker image..."
@@ -75,16 +38,30 @@ jobs:
- name: Create release in Gitea - name: Create release in Gitea
run: | run: |
apk add --no-cache jq apk add --no-cache jq curl
VERSION=$(jq -r '.version' package.json) VERSION=$(jq -r '.version' package.json)
echo "Current version: v$VERSION" echo "Current version: v$VERSION"
# Shell-kompatible Prüfung (funktioniert zuverlässig in Alpine/sh)
case "$VERSION" in
0.*)
IS_PRERELEASE="true"
echo "Version starts with 0. Setting prerelease to true."
;;
*)
IS_PRERELEASE="false"
echo "Setting prerelease to false."
;;
esac
# Prüfen, ob das Release bereits existiert
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
"http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/releases/tags/v$VERSION") "http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/releases/tags/v$VERSION")
if [ "$HTTP_STATUS" -eq 404 ]; then if [ "$HTTP_STATUS" -eq 404 ]; then
echo "Creating new release v$VERSION..." echo "Creating new release v$VERSION..."
# Gitea erstellt bei diesem Call automatisch auch den Tag v$VERSION auf 'main'
curl -X POST \ curl -X POST \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
@@ -94,7 +71,7 @@ jobs:
\"name\": \"Release v$VERSION\", \"name\": \"Release v$VERSION\",
\"body\": \"Automated release for version v$VERSION\", \"body\": \"Automated release for version v$VERSION\",
\"draft\": false, \"draft\": false,
\"prerelease\": false \"prerelease\": $IS_PRERELEASE
}" \ }" \
"http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/releases" "http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/releases"
else else