-
Notifications
You must be signed in to change notification settings - Fork 21
60 lines (51 loc) · 1.78 KB
/
Copy pathdockerimage.yml
File metadata and controls
60 lines (51 loc) · 1.78 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
name: Push Docker Image
on:
push:
branches:
- main
- stage
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Login into Registry
uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@v2
- name: Get Short SHA
id: vars
run: |
echo ::set-output name=short_sha::$(git rev-parse --short=7 ${{ github.sha }})
- name: Build the Docker image
run: |
docker build --build-arg MIX_ENV=prod \
--build-arg PG_MAJOR=11 \
--build-arg NODE_MAJOR=18 \
--build-arg DEFAULT_LOCALE=es \
--build-arg YARN_VERSION=1.13.0 \
-t michelson/rauversion \
.
- name: Tag and Push Docker image
if: github.event_name == 'push'
run: |
docker tag michelson/rauversion michelson/rauversion:$SHORT_SHA
docker push michelson/rauversion:$SHORT_SHA
echo "SHORT_SHA: ${SHORT_SHA}"
env:
SHORT_SHA: ${{ steps.vars.outputs.short_sha }}
- name: Tag LATEST and Push Docker image
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
docker tag michelson/rauversion michelson/rauversion:latest
docker push michelson/rauversion:latest
echo "LATEST deployed!"
- name: Tag RELEASE and Push Docker image
if: github.event_name == 'release'
run: |
docker tag michelson/rauversion michelson/rauversion:${{ github.ref_name }}
docker push michelson/rauversion:${{ github.ref_name }}
echo "${{ github.ref_name }} deployed!"