-
-
Notifications
You must be signed in to change notification settings - Fork 57
39 lines (30 loc) · 981 Bytes
/
image-workflow.yaml
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
name: donut-server-image-ci
on:
push:
branches:
- development
tags:
- v*
env:
IMAGE_NAME: donut-server:latest
REPO_NAME: codeuino1
REGISTRY_NAME: registry.hub.docker.com
jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker build . --file Dockerfile.prod --tag $IMAGE_NAME
- name: Log into registry
run: echo "{{ secrets.DOCKER_PASSWORD }}" | docker login -u {{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push image
run: |
IMAGE_ID=$REGISTRY_NAME/$REPO_NAME/$IMAGE_NAME
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker push $IMAGE_ID:$VERSION