Merge pull request 'Environment' (#8) from environment into main
Deploy Next.js via Docker / deploy (push) Successful in 6m29s

Reviewed-on: Schanbro/PsalmTafel#8
This commit was merged in pull request #8.
This commit is contained in:
robin committed 2026-07-25 18:26:41 +00:00
commit 08e2fd088c
2 files changed
+13 -17

No files matched your search

+11 -15
View File
@@ -11,47 +11,43 @@ jobs:
container: container:
image: docker:latest image: docker:latest
steps: steps:
- name: Code auschecken - name: Checkout code
run: | run: |
apk add --no-cache curl unzip apk add --no-cache curl unzip
curl -L -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ curl -L -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
"http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/archive/main.zip" -o repo.zip "http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/archive/main.zip" -o repo.zip
unzip repo.zip unzip repo.zip
# Verschiebt alle Dateien aus dem Zip-Unterordner direkt hierher ins Hauptverzeichnis
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: Docker Container aktualisieren - name: Update Docker container
run: | run: |
# Kein 'cd' mehr! Wir sind schon im richtigen Ordner, wo dein Dockerfile liegt. echo "Building new Next.js Docker image..."
echo "Baue das neue Next.js Docker-Image..."
docker build -t psalmtafel-app . docker build -t psalmtafel-app .
echo "Stoppe alten Container, falls er läuft..." echo "Stopping old container if running..."
docker stop psalmtafel-container || true docker stop psalmtafel-container || true
docker rm psalmtafel-container || true docker rm psalmtafel-container || true
echo "Starte neuen Container..." echo "Starting new container..."
docker run -d \ docker run -d \
--name psalmtafel-container \ --name psalmtafel-container \
-p 8443:3000 \ -p 8443:3000 \
--restart always \ --restart always \
psalmtafel-app psalmtafel-app
- name: Release in Gitea erstellen
- name: Create release in Gitea
run: | run: |
# 1. jq installieren und Version aus package.json auslesen
apk add --no-cache jq apk add --no-cache jq
VERSION=$(jq -r '.version' package.json) VERSION=$(jq -r '.version' package.json)
echo "Aktuelle Version: v$VERSION" echo "Current version: v$VERSION"
# 2. Prüfen, ob das Release/Tag 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")
# 3. Wenn Release noch nicht existiert (404), erstelle es
if [ "$HTTP_STATUS" -eq 404 ]; then if [ "$HTTP_STATUS" -eq 404 ]; then
echo "Erstelle neues Release v$VERSION..." echo "Creating new release v$VERSION..."
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" \
@@ -59,11 +55,11 @@ jobs:
\"tag_name\": \"v$VERSION\", \"tag_name\": \"v$VERSION\",
\"target_commitish\": \"main\", \"target_commitish\": \"main\",
\"name\": \"Release v$VERSION\", \"name\": \"Release v$VERSION\",
\"body\": \"Automatisches Release für Version v$VERSION\", \"body\": \"Automated release for version v$VERSION\",
\"draft\": false, \"draft\": false,
\"prerelease\": false \"prerelease\": false
}" \ }" \
"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
echo "Release v$VERSION existiert bereits. Überspringe Erstellung." echo "Release v$VERSION already exists. Skipping creation."
fi fi
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "lied-nummer-anzeige", "name": "psalm-talel",
"version": "0.0.2", "version": "0.0.3",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",