All checks were successful
Build and Deploy Erika CV / build-and-deploy (push) Successful in 35s
68 lines
1.8 KiB
YAML
68 lines
1.8 KiB
YAML
name: Build and Deploy Erika CV
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: debian-host
|
|
|
|
env:
|
|
PATH: /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/snap/bin
|
|
DOCKER_HOST: unix:///var/run/docker.sock
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: System info
|
|
run: |
|
|
uname -a
|
|
whoami
|
|
|
|
- name: Verify Docker
|
|
run: docker --version
|
|
|
|
- name: Log in to Docker Registry
|
|
run: |
|
|
echo "${{ secrets.HARBOR_ROBOT_TOKEN }}" | docker login registry.i80.dk -u "robot\$gitserver" --password-stdin
|
|
|
|
- name: Build and push Docker image
|
|
run: |
|
|
docker build \
|
|
--build-arg BUILD_VERSION=${{ github.ref_name }}-${{ github.sha }} \
|
|
--build-arg GIT_COMMIT=${{ github.sha }} \
|
|
--build-arg BUILD_TIME=${{ github.event.head_commit.timestamp }} \
|
|
-t registry.i80.dk/gitea/web-erika:latest \
|
|
-f ./Dockerfile \
|
|
.
|
|
docker push registry.i80.dk/gitea/web-erika:latest
|
|
|
|
- name: Deploy to Nomad
|
|
run: |
|
|
nomad job validate erika.nomad
|
|
nomad job run erika.nomad
|
|
env:
|
|
NOMAD_ADDR: "https://nomad.i80.dk:4646"
|
|
|
|
- name: Wait for deployment
|
|
run: |
|
|
nomad job status web-erika
|
|
echo "=== Allocation Details ==="
|
|
nomad job allocs web-erika
|
|
echo "=== Logs ==="
|
|
for alloc in $(nomad job allocs web-erika -short | tail -n +2 | awk '{print $1}'); do
|
|
nomad alloc logs $alloc || echo "No logs for $alloc"
|
|
done
|
|
env:
|
|
NOMAD_ADDR: "https://nomad.i80.dk:4646"
|
|
|
|
- name: Notify deployment status
|
|
run: |
|
|
echo "Deployment completed!"
|
|
echo "Service: https://ecv.i80.dk"
|
|
echo "Health: https://ecv.i80.dk/health"
|