Update main.yml
This commit is contained in:
8
.github/workflows/main.yml
vendored
8
.github/workflows/main.yml
vendored
@@ -3,7 +3,7 @@ name: Deploy Next.js to Raspberry Pi
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- production
|
||||
- dev
|
||||
- preview
|
||||
|
||||
@@ -17,8 +17,8 @@ jobs:
|
||||
|
||||
- name: Set Environment Variables
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
||||
echo "DEPLOY_ENV=main" >> $GITHUB_ENV
|
||||
if [[ "${{ github.ref_name }}" == "production" ]]; then
|
||||
echo "DEPLOY_ENV=production" >> $GITHUB_ENV
|
||||
echo "PORT=3000" >> $GITHUB_ENV
|
||||
elif [[ "${{ github.ref_name }}" == "dev" ]]; then
|
||||
echo "DEPLOY_ENV=dev" >> $GITHUB_ENV
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
# Rename new container to the old container’s 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
|
||||
else
|
||||
echo "New container failed to start."
|
||||
|
||||
Reference in New Issue
Block a user