Merge branch 'production' of https://github.com/Denshooter/my_portfolio into production

This commit is contained in:
2025-02-10 11:20:07 +01:00

View File

@@ -3,7 +3,7 @@ name: Deploy Next.js to Raspberry Pi
on: on:
push: push:
branches: branches:
- main - production
- dev - dev
- preview - preview
@@ -17,8 +17,8 @@ jobs:
- name: Set Environment Variables - name: Set Environment Variables
run: | run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then if [[ "${{ github.ref_name }}" == "production" ]]; then
echo "DEPLOY_ENV=main" >> $GITHUB_ENV echo "DEPLOY_ENV=production" >> $GITHUB_ENV
echo "PORT=3000" >> $GITHUB_ENV echo "PORT=3000" >> $GITHUB_ENV
elif [[ "${{ github.ref_name }}" == "dev" ]]; then elif [[ "${{ github.ref_name }}" == "dev" ]]; then
echo "DEPLOY_ENV=dev" >> $GITHUB_ENV echo "DEPLOY_ENV=dev" >> $GITHUB_ENV
@@ -57,7 +57,7 @@ jobs:
# Rename new container to the old containers name # Rename new container to the old containers name
docker rename "$NEW_CONTAINER_NAME" "$CONTAINER_NAME" docker rename "$NEW_CONTAINER_NAME" "$CONTAINER_NAME"
# Reassign the desired port (e.g., 3000 for main branch) to the new container # Reassign the desired port (e.g., 3000 for production branch) to the new container
docker run -d --name "$CONTAINER_NAME" -p $PORT:3000 $IMAGE_NAME docker run -d --name "$CONTAINER_NAME" -p $PORT:3000 $IMAGE_NAME
else else
echo "New container failed to start." echo "New container failed to start."