Compare commits
52
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1f928d376 | ||
|
|
a7e7cbf5f8 | ||
|
|
f101e0aaaf | ||
|
|
1544608eeb | ||
|
|
bdc23cc8dc | ||
|
|
8008742be3 | ||
|
|
702332c299 | ||
|
|
f843fcd090 | ||
|
|
a2115f6af4 | ||
|
|
12056afa87 | ||
|
|
6a547f55a3 | ||
|
|
009124c286 | ||
|
|
d6475f1c5b | ||
|
|
2aee8ece58 | ||
|
|
157609225f | ||
|
|
82279f946d | ||
|
|
2b99460964 | ||
|
|
8ccc2008c4 | ||
|
|
a290a109b5 | ||
|
|
5ed91068a5 | ||
|
|
72bd7f26ea | ||
|
|
5aa5631d7a | ||
|
|
7514c7d846 | ||
|
|
26caaadf56 | ||
|
|
e174200d96 | ||
|
|
e978e2fb99 | ||
|
|
28fb46b5bf | ||
|
|
4ad6175e43 | ||
|
|
194492200c | ||
|
|
0346be16f7 | ||
|
|
eba825b451 | ||
|
|
08e8fa4c70 | ||
|
|
7dc324d331 | ||
|
|
4ab5f40782 | ||
|
|
08dd5e12a7 | ||
|
|
39eb5ba72e | ||
|
|
0c4871bda4 | ||
|
|
3b504bda1e | ||
|
|
d8ef8490d1 | ||
|
|
eaf82d0c34 | ||
|
|
a8d939481f | ||
|
|
0ec3ba7bf5 | ||
|
|
1560ff4c06 | ||
|
|
af71466c9f | ||
|
|
d892a0b410 | ||
|
|
31a3877183 | ||
|
|
f1f52ee002 | ||
|
|
5277e98b32 | ||
|
|
5e0e00b3ca | ||
|
|
11cd39aced | ||
|
|
4b587b543c | ||
|
|
f688952ed8 |
No files matched your search
@@ -1,4 +1,4 @@
|
||||
name: Deploy Next.js via Docker
|
||||
name: Build, Package & Release Next.js
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,64 +6,79 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
build-and-push:
|
||||
name: Build & Push Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker:latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
run: |
|
||||
apk add --no-cache curl unzip
|
||||
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
|
||||
unzip repo.zip
|
||||
mv PsalmTafel/* . 2>/dev/null || mv psalmtafel/* . 2>/dev/null || mv */* . 2>/dev/null
|
||||
rm repo.zip
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repository-url: http://gitea:3000/${{ github.repository }}
|
||||
ref: main
|
||||
|
||||
- name: Update Docker container
|
||||
- name: Read Version & Lowercase Repo Name
|
||||
run: |
|
||||
echo "Building new Next.js Docker image..."
|
||||
docker build -t psalmtafel-app .
|
||||
|
||||
echo "Stopping old container if running..."
|
||||
docker stop psalmtafel-container || true
|
||||
docker rm psalmtafel-container || true
|
||||
|
||||
echo "Starting new container..."
|
||||
docker run -d \
|
||||
--name psalmtafel-container \
|
||||
-p 8443:3000 \
|
||||
--restart always \
|
||||
psalmtafel-app
|
||||
|
||||
- name: Create release in Gitea
|
||||
run: |
|
||||
apk add --no-cache jq curl
|
||||
VERSION=$(jq -r '.version' package.json)
|
||||
echo "Current version: v$VERSION"
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
|
||||
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
|
||||
echo "REPO_LOWER=$REPO_LOWER" >> $GITHUB_ENV
|
||||
|
||||
# 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
|
||||
- name: Log in to Gitea Container Registry
|
||||
run: |
|
||||
USER_LOWER=$(echo "${{ github.actor }}" | tr '[:upper:]' '[:lower:]')
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea:3000 -u "$USER_LOWER" --password-stdin
|
||||
|
||||
- name: Docker Image bauen (nur lokal im Runner)
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
tags: |
|
||||
gitea:3000/${{ env.REPO_LOWER }}:v${{ env.VERSION }}
|
||||
gitea:3000/${{ env.REPO_LOWER }}:latest
|
||||
|
||||
- name: Images zu Gitea pushen
|
||||
run: |
|
||||
docker push gitea:3000/${{ env.REPO_LOWER }}:v${{ env.VERSION }}
|
||||
docker push gitea:3000/${{ env.REPO_LOWER }}:latest
|
||||
|
||||
create-release:
|
||||
name: Create Gitea Release
|
||||
needs: build-and-push
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repository-url: http://gitea:3000/${{ github.repository }}
|
||||
ref: main
|
||||
|
||||
- name: Create Release via Gitea API
|
||||
run: |
|
||||
VERSION=$(jq -r '.version' package.json)
|
||||
|
||||
if [[ "$VERSION" == 0.* ]]; then
|
||||
PRERELEASE="true"
|
||||
else
|
||||
PRERELEASE="false"
|
||||
fi
|
||||
|
||||
# Prüfen, ob das Release 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")
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"http://gitea:3000/api/v1/repos/${{ github.repository }}/releases/tags/v$VERSION")
|
||||
|
||||
if [ "$HTTP_STATUS" -eq 404 ]; then
|
||||
echo "Creating new release v$VERSION..."
|
||||
# Gitea erstellt bei diesem Call automatisch auch den Tag v$VERSION auf 'main'
|
||||
echo "Creating release v$VERSION in Gitea..."
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"tag_name\": \"v$VERSION\",
|
||||
@@ -71,9 +86,9 @@ jobs:
|
||||
\"name\": \"Release v$VERSION\",
|
||||
\"body\": \"Automated release for version v$VERSION\",
|
||||
\"draft\": false,
|
||||
\"prerelease\": $IS_PRERELEASE
|
||||
\"prerelease\": $PRERELEASE
|
||||
}" \
|
||||
"http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/releases"
|
||||
"http://gitea:3000/api/v1/repos/${{ github.repository }}/releases"
|
||||
else
|
||||
echo "Release v$VERSION already exists. Skipping creation."
|
||||
echo "Release v$VERSION exists already. Skipping."
|
||||
fi
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "psalm-tafel",
|
||||
"version": "0.0.5.1",
|
||||
"version": "0.0.5.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
Reference in new issue
Block a user