48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
name: deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: docker
|
|
|
|
container:
|
|
image: docker:27-cli
|
|
|
|
steps:
|
|
- name: install tools
|
|
run: |
|
|
apk add --no-cache git openssh
|
|
|
|
- name: clone repo
|
|
run: |
|
|
git clone https://git.infra.mintel.me/mmintel/mb-grid-solutions.com .
|
|
git checkout main
|
|
|
|
- name: login to registry
|
|
env:
|
|
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
|
REGISTRY_PASS: ${{ secrets.REGISTRY_PASS }}
|
|
run: |
|
|
echo "$REGISTRY_PASS" | docker login registry.infra.mintel.me -u "$REGISTRY_USER" --password-stdin
|
|
|
|
- name: build image
|
|
run: |
|
|
docker build -t registry.infra.mintel.me/mintel/mb-grid-solutions:latest .
|
|
|
|
- name: push image
|
|
run: |
|
|
docker push registry.infra.mintel.me/mintel/mb-grid-solutions:latest
|
|
|
|
- name: deploy to alpha
|
|
env:
|
|
ALPHA_SSH_KEY: ${{ secrets.ALPHA_SSH_KEY }}
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "$ALPHA_SSH_KEY" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
ssh -o StrictHostKeyChecking=no deploy@alpha.mintel.me \
|
|
"cd /opt/alpha/sites/mb-grid-solutions && docker compose pull && docker compose up -d" |