🐳 Deploy image to the internal docker registry
* Deploy the image to the internal docker registry * Removed unnecessary stage in backend build
This commit is contained in:
@@ -0,0 +1,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:
|
||||
- "twake/frontend/**"
|
||||
- "twake/docker/**"
|
||||
- ".github/workflows/**"
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "twake/frontend/**"
|
||||
|
||||
jobs:
|
||||
build-frontend:
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
FRONTEND_ENV: ${{secrets.FRONTEND_ENV}}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.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 twake/frontend/ && yarn install
|
||||
- run: cp twake/frontend/src/app/environment/environment.ts.dist twake/frontend/src/app/environment/environment.ts
|
||||
- if: ${{env.FRONTEND_ENV}}
|
||||
run: echo ${{ secrets.FRONTEND_ENV }} > twake/frontend/src/app/environment/environment.ts
|
||||
- run: cd twake/frontend/ && yarn test
|
||||
- run: cd twake/frontend/ && yarn build
|
||||
- name: Upload frontend build artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: frontend-build
|
||||
path: twake/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: twake
|
||||
buildoptions: "-t docker-registry.linagora.com/tdrive/tdrive-frontend -f docker/tdrive-frontend/Dockerfile"
|
||||
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"
|
||||
Reference in New Issue
Block a user