-
Notifications
You must be signed in to change notification settings - Fork 14
48 lines (45 loc) · 1.46 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
45
46
47
48
name: Continuous Integration
on:
push:
schedule:
- cron: '0 17 * * *' # 3 AM AEST
jobs:
image:
env:
IMAGE_REPO: ${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }}
IMAGE_TAG: sha-${{ github.sha }}
runs-on:
- linux
- self-hosted
- x64
steps:
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/build-push-action@v2
with:
file: Dockerfile
no-cache: ${{ github.event_name == 'schedule' }}
push: true
tags: ${{ env.IMAGE_REPO }}:sha-${{ env.IMAGE_TAG }}
- name: Push branch tag
run: |
docker tag ${{ env.IMAGE_REPO }}:sha-${{ env.IMAGE_TAG }} ${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/}
docker push ${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/}
- name: Push 'latest' tag
if: github.ref == 'refs/heads/master'
run: |
docker tag ${{ env.IMAGE_REPO }}:sha-${{ env.IMAGE_TAG }} ${{ env.IMAGE_REPO }}:latest
docker push ${{ env.IMAGE_REPO }}:latest
readme:
needs: image
runs-on:
- self-hosted
steps:
- uses: actions/checkout@v2
- uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }}