Compare commits
2 Commits
877005ed79
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 64170db444 | |||
| 563787c8cb |
62
.github/workflows/deploy.yml
vendored
62
.github/workflows/deploy.yml
vendored
@@ -4,72 +4,16 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
tags: |
|
|
||||||
type=raw,value=latest
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build-and-push
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy to Remote Server
|
- name: Deploy Application
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.REMOTE_HOST }}
|
host: ${{ secrets.REMOTE_HOST }}
|
||||||
username: ${{ secrets.REMOTE_USER }}
|
username: ${{ secrets.REMOTE_USER }}
|
||||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
passphrase: ${{ secrets.SSH_PASSPHRASE }}
|
||||||
script: |
|
script: |
|
||||||
# Login to registry
|
powershell -ExecutionPolicy Bypass -Command "Write-Host '=== Starting deployment ==='; if (Test-Path 'C:\projects\digital-resume-FE') { Set-Location 'C:\projects\digital-resume-FE'; git pull origin main } else { New-Item -ItemType Directory -Path 'C:\projects' -Force; Set-Location 'C:\projects'; git clone https://gitea.sashabayda.ca/Bayda77/digital-resume-FE.git }; Write-Host '=== Stopping container ==='; docker stop resume-frontend; docker rm resume-frontend; Write-Host '=== Building image ==='; Set-Location 'C:\projects\digital-resume-FE'; docker build -t resume-frontend:latest .; Write-Host '=== Running container ==='; docker run -d --name resume-frontend --restart unless-stopped -p 3001:80 resume-frontend:latest; Write-Host '=== Verifying ==='; docker ps -a --filter name=resume-frontend"
|
||||||
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
||||||
|
|
||||||
# Pull new image
|
|
||||||
docker pull ghcr.io/${{ env.IMAGE_NAME }}:latest
|
|
||||||
|
|
||||||
# Stop and remove existing container
|
|
||||||
docker stop resume-frontend || true
|
|
||||||
docker rm resume-frontend || true
|
|
||||||
|
|
||||||
# Run new container
|
|
||||||
docker run -d \
|
|
||||||
--name resume-frontend \
|
|
||||||
--restart unless-stopped \
|
|
||||||
-p 80:80 \
|
|
||||||
ghcr.io/${{ env.IMAGE_NAME }}:latest
|
|
||||||
|
|
||||||
# Cleanup unused images
|
|
||||||
docker image prune -f
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default function Contact() {
|
|||||||
>
|
>
|
||||||
<div className="contact-intro">
|
<div className="contact-intro">
|
||||||
<p>
|
<p>
|
||||||
I'd love to hear from you! Feel free to reach out through any of these channels:
|
I would love to hear from you! Feel free to reach out through any of these channels:
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user