-
Notifications
You must be signed in to change notification settings - Fork 22
56 lines (54 loc) · 2.19 KB
/
publish-backend.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
49
50
51
52
53
54
55
56
name: publish-backend
# Deploy backend only if push on "main"
on:
push:
branches: [main]
paths:
- "tdrive/docker/**"
- "tdrive/backend/**"
- ".github/workflows/**"
jobs:
publish-node:
runs-on: ubuntu-20.04
steps:
- name: "Setup version"
run: 'echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
- name: Set env to develop
if: endsWith(github.ref, '/develop')
run: 'echo "DOCKERTAG=develop" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
- name: Set env to develop
if: endsWith(github.ref, '/qa')
run: 'echo "DOCKERTAG=qa" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=2023.Q1.1223" >> $GITHUB_ENV'
- name: Set env to develop
if: endsWith(github.ref, '/canary')
run: 'echo "DOCKERTAG=canary" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=${{ env.DOCKERTAGVERSION }}-canary" >> $GITHUB_ENV'
- name: Set env to production
if: endsWith(github.ref, '/main')
run: 'echo "DOCKERTAG=latest" >> $GITHUB_ENV'
- name: "Push to the registry following labels:"
run: |
echo "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"
- uses: actions/checkout@v2
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: tdrive/tdrive-node
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
workdir: tdrive
registry: docker-registry.linagora.com
context: .
target: production
buildoptions: "-t docker-registry.linagora.com/tdrive/tdrive-node -f docker/tdrive-node/Dockerfile"
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"
- name: Publish to dockerhub
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: twakedrive/tdrive-node
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
workdir: tdrive
context: .
target: production
buildoptions: "-t twakedrive/tdrive-node -f docker/tdrive-node/Dockerfile"
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"