Skip to content

✨ Sorting and Filtering Menu (#126) #264

✨ Sorting and Filtering Menu (#126)

✨ Sorting and Filtering Menu (#126) #264

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 }}"