-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (35 loc) · 1.27 KB
/
ci.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
---
name: "CI-Docker-Build"
on: # yamllint disable-line rule:truthy rule:comments
- "push"
- "pull_request"
jobs:
build:
name: "Publish to Docker Registry"
runs-on: "ubuntu-20.04"
steps:
- uses: "actions/checkout@v2"
with:
submodules: "recursive"
- name: "Setup Hugo"
run: "docker-compose build blog"
- uses: "docker/login-action@v1"
with:
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_TOKEN }}"
- name: "SET DEVELOP TAG"
if: github.ref == 'refs/heads/develop'
run: |
echo "IMAGE_TAG=${{ secrets.DOCKERHUB_USERNAME }}/dev-knot-blog:develop" >> $GITHUB_ENV
- name: "SET LATEST TAG"
if: github.ref == 'refs/heads/main'
run: |
echo "IMAGE_TAG=${{ secrets.DOCKERHUB_USERNAME }}/dev-knot-blog:latest" >> $GITHUB_ENV
- name: "Docker Compose Build"
run: "docker-compose build blog"
- name: "Docker Push"
run: "docker push ${{ secrets.DOCKERHUB_USERNAME }}/dev-knot-blog:develop"
if: github.ref == 'refs/heads/develop'
- name: "Docker Push"
run: "docker push ${{ secrets.DOCKERHUB_USERNAME }}/dev-knot-blog:latest"
if: github.ref == 'refs/heads/main'