-
Notifications
You must be signed in to change notification settings - Fork 18
74 lines (69 loc) · 2.81 KB
/
publish-frontend.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: publish-frontend
# Edit with caution ! Made for build+test on "feature/*" push and pull requests events
# And for only deploying on pushes on "main" branch
on:
push:
branches: [main]
paths:
- "tdrive/frontend/**"
- "tdrive/docker/**"
- ".github/workflows/**"
pull_request:
branches: [main]
paths:
- "tdrive/frontend/**"
jobs:
build-frontend:
runs-on: ubuntu-20.04
env:
FRONTEND_ENV: ${{secrets.FRONTEND_ENV}}
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install -g yarn
- run: cd tdrive/frontend/ && yarn install
- run: cp tdrive/frontend/src/app/environment/environment.ts.dist tdrive/frontend/src/app/environment/environment.ts
- if: ${{env.FRONTEND_ENV}}
run: echo ${{ secrets.FRONTEND_ENV }} > tdrive/frontend/src/app/environment/environment.ts
- run: cd tdrive/frontend/ && yarn test
- run: cd tdrive/frontend/ && yarn build
- name: Upload frontend build artifact
uses: actions/upload-artifact@v1
with:
name: frontend-build
path: tdrive/frontend/build/
publish-frontend:
# needs: build-frontend
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/qa' || github.ref == 'refs/heads/canary'
steps:
- 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'
- uses: actions/checkout@v2
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: tdrive/tdrive-frontend
registry: docker-registry.linagora.com
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
workdir: tdrive
buildoptions: "-t docker-registry.linagora.com/tdrive/tdrive-frontend -f docker/tdrive-frontend/Dockerfile"
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"