-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (35 loc) · 1.26 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Deploy
on: push
jobs:
build-and-deploy:
name: build and deploy (main)
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker registry
uses: docker/login-action@v2
with:
registry: postmodern.alexdaniel.org
username: 'oppejoud.ee'
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
tags: postmodern.alexdaniel.org/oppejoud-backend:${{ github.sha }} ${{ github.ref == 'refs/heads/main' && ', postmodern.alexdaniel.org/oppejoud-backend:latest' || '' }}
- name: Set SSH key
if: github.ref == 'refs/heads/main'
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
- name: Auth
if: github.ref == 'refs/heads/main'
run: ssh-keyscan -H postmodern.alexdaniel.org >> ~/.ssh/known_hosts
- name: Deploy
if: github.ref == 'refs/heads/main'
run: docker stack deploy --with-registry-auth -c compose.yaml oppejoud-backend
env:
DOCKER_HOST: ssh://[email protected]