Repository navigation
73 lines (65 loc) · 2.46 KB
/
Copy pathdocker-image.yml
File metadata and controls
73 lines (65 loc) · 2.46 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Docker Image CI
on:
push:
branches:
- main
workflow_dispatch: {}
jobs:
build:
name: 'Build'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: "Build:checkout"
uses: actions/checkout@v2
with:
submodules: recursive
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
client:
- 'client/**'
- '.github/workflows/docker-image.yml'
server:
- 'server/**'
- '.github/workflows/docker-image.yml'
- name: Login to Docker Hub
if: steps.changes.outputs.client == 'true' || steps.changes.outputs.server == 'true' || github.event_name == 'workflow_dispatch'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build:dockerimage-client'
if: steps.changes.outputs.client == 'true' || github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v4
with:
context: ./client
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-client:latest
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-client:${{github.sha}}
- name: 'Build:dockerimage-server'
if: steps.changes.outputs.server == 'true' || github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v4
with:
context: ./server
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-server:latest
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-server:${{github.sha}}
- name: 'Update client service'
if: (steps.changes.outputs.client == 'true' || github.event_name == 'workflow_dispatch') && !cancelled()
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.CLIENT_WEBHOOK }}
preventFailureOnNoResponse: true
- name: 'Update server service'
if: (steps.changes.outputs.server == 'true' || github.event_name == 'workflow_dispatch') && !cancelled()
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.SERVER_WEBHOOK }}
preventFailureOnNoResponse: true