This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (57 loc) · 1.85 KB
/
docker.yml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Docker
on:
push:
branches: 'master'
pull_request:
types: [opened, reopened, synchronize]
branches: [master]
workflow_dispatch:
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Build the Docker image
run: docker build --file Dockerfile --tag ${{ github.repository}}:$(git rev-parse --abbrev-ref HEAD | sed 's/[^a-zA-Z0-9]/-/g') .
publish-image:
runs-on: ubuntu-latest
needs: build-image
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Publish to registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ github.repository }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
deploy-production:
runs-on: ubuntu-latest
needs: publish-image
if: github.ref == 'refs/heads/master'
environment: "production"
steps:
- name: Execute deployment on SSH
uses: appleboy/ssh-action@v1.0.1
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: /tank/containers/deploy/pohles-api.sh
# deploy-dev:
# runs-on: ubuntu-latest
# if: github.ref != 'refs/heads/master'
# environment: "dev"
# steps:
# - name: Execute deployment on SSH
# uses: appleboy/ssh-action@v1.0.1
# with:
# host: ${{ secrets.SSH_HOST }}
# username: ${{ secrets.SSH_USERNAME }}
# key: ${{ secrets.SSH_KEY }}
# port: ${{ secrets.SSH_PORT }}
# script: /tank/containers/deploy/pohles-api-dev.sh ${{ github.head_ref || github.ref_name }}