-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (40 loc) · 1.81 KB
/
docker-image.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
name: Docker Image CI
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
if: startsWith(github.ref, 'refs/tags/')
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_IMAGE_NAME }}:latest
- name: Build the Docker image with a temporary name
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
run: docker build . --file Dockerfile --tag tmp:notag
- name: Docker Login
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Tag latest docker image
if: startsWith(github.ref, 'refs/tags/')
run: docker tag ${{ secrets.DOCKER_IMAGE_NAME }}:latest wseresearch/${{ secrets.DOCKER_IMAGE_NAME }}:latest
- name: Tag docker image version
if: startsWith(github.ref, 'refs/tags/')
run: docker tag ${{ secrets.DOCKER_IMAGE_NAME }}:latest "wseresearch/${{ secrets.DOCKER_IMAGE_NAME }}:${{ github.ref_name }}"
- name: Push latest docker image
if: startsWith(github.ref, 'refs/tags/')
run: docker push wseresearch/${{ secrets.DOCKER_IMAGE_NAME }}:latest
- name: Replace docker volume mapping if existing
if: startsWith(github.ref, 'refs/tags/')
run: sed -i 's/VOLUME_SETTING/${{ secrets.VOLUMES }}/g' service_config/service_config.json
- name: Push docker image version
if: startsWith(github.ref, 'refs/tags/')
run: docker push "wseresearch/${{ secrets.DOCKER_IMAGE_NAME }}:${{ github.ref_name }}"
- name: Init update
if: startsWith(github.ref, 'refs/tags/')
uses: WSE-research/[email protected]
with:
updater_host: ${{ secrets.UPDATER_HOST }}
api_key: ${{ secrets.API_KEY }}