👷 Refactored build and publish workflow (#435)
This commit is contained in:
@@ -1,44 +0,0 @@
|
|||||||
name: backend-build
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
paths:
|
|
||||||
- "tdrive/backend/node/**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Prettier code style check
|
|
||||||
run: cd tdrive && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run lint:prettier
|
|
||||||
- name: Lint
|
|
||||||
run: cd tdrive && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run lint
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: e2e-mongo-test
|
|
||||||
run: |
|
|
||||||
cd tdrive
|
|
||||||
docker-compose -f docker-compose.tests.yml run --rm -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:all
|
|
||||||
docker-compose -f docker-compose.tests.yml down
|
|
||||||
- name: e2e-opensearch-test
|
|
||||||
run: |
|
|
||||||
cd tdrive
|
|
||||||
docker-compose -f docker-compose.dev.tests.opensearch.yml up -d --force-recreate opensearch-node1 postgres node
|
|
||||||
sleep 60
|
|
||||||
docker-compose -f docker-compose.dev.tests.opensearch.yml logs
|
|
||||||
docker-compose -f docker-compose.dev.tests.opensearch.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=opensearch -e DB_DRIVER=postgres -e PUBSUB_TYPE=local node npm run test:all
|
|
||||||
docker-compose -f docker-compose.dev.tests.opensearch.yml down
|
|
||||||
- name: e2e-cassandra-test
|
|
||||||
run: cd tdrive && docker-compose -f docker-compose.tests.yml up -d scylladb elasticsearch rabbitmq && sleep 60 && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=elasticsearch -e DB_DRIVER=cassandra node npm run test:all
|
|
||||||
- name: coverage
|
|
||||||
uses: adRise/jest-cov-reporter@main
|
|
||||||
with:
|
|
||||||
branch-coverage-report-path: ./tdrive/coverage/coverage-summary.json
|
|
||||||
base-coverage-report-path: ./tdrive/coverage/coverage-summary.json
|
|
||||||
delta: 0.3
|
|
||||||
fullCoverageDiff: true
|
|
||||||
|
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- "tdrive/backend/node/**"
|
||||||
|
- "tdrive/frontend/**"
|
||||||
|
- "tdrive/connectors/onlyoffice-connector/**"
|
||||||
|
- "tdrive/backend/utils/ldap-sync/**"
|
||||||
|
- "tdrive/backend/utils/nextcloud-migration/**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
name: Setup jobs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
changes: ${{ steps.filter.outputs.changes }}
|
||||||
|
steps:
|
||||||
|
- uses: dorny/paths-filter@v3
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
backend:
|
||||||
|
- "tdrive/backend/node/**"
|
||||||
|
frontend:
|
||||||
|
- "tdrive/frontend/**"
|
||||||
|
onlyoffice-connector:
|
||||||
|
- "tdrive/connectors/onlyoffice-connector/**"
|
||||||
|
ldap-sync:
|
||||||
|
- "tdrive/backend/utils/ldap-sync/**"
|
||||||
|
nextcloud-migration:
|
||||||
|
- "tdrive/backend/utils/nextcloud-migration/**"
|
||||||
|
|
||||||
|
lint-backend:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: contains(needs.setup.outputs.changes, 'backend')
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Prettier code style check
|
||||||
|
run: |
|
||||||
|
cd tdrive
|
||||||
|
docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run lint:prettier
|
||||||
|
- name: Lint
|
||||||
|
run: |
|
||||||
|
cd tdrive
|
||||||
|
docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run lint
|
||||||
|
|
||||||
|
test-backend:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: contains(needs.setup.outputs.changes, 'backend')
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: e2e-mongo-test
|
||||||
|
run: |
|
||||||
|
cd tdrive
|
||||||
|
docker-compose -f docker-compose.tests.yml run --rm -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:all
|
||||||
|
docker-compose -f docker-compose.tests.yml down
|
||||||
|
- name: e2e-opensearch-test
|
||||||
|
run: |
|
||||||
|
cd tdrive
|
||||||
|
docker-compose -f docker-compose.dev.tests.opensearch.yml up -d --force-recreate opensearch-node1 postgres node
|
||||||
|
sleep 60
|
||||||
|
docker-compose -f docker-compose.dev.tests.opensearch.yml logs
|
||||||
|
docker-compose -f docker-compose.dev.tests.opensearch.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=opensearch -e DB_DRIVER=postgres -e PUBSUB_TYPE=local node npm run test:all
|
||||||
|
docker-compose -f docker-compose.dev.tests.opensearch.yml down
|
||||||
|
- name: e2e-cassandra-test
|
||||||
|
run: |
|
||||||
|
cd tdrive
|
||||||
|
docker-compose -f docker-compose.tests.yml up -d scylladb elasticsearch rabbitmq
|
||||||
|
sleep 60
|
||||||
|
docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=elasticsearch -e DB_DRIVER=cassandra node npm run test:all
|
||||||
|
- name: coverage
|
||||||
|
uses: adRise/jest-cov-reporter@main
|
||||||
|
with:
|
||||||
|
branch-coverage-report-path: ./tdrive/coverage/coverage-summary.json
|
||||||
|
base-coverage-report-path: ./tdrive/coverage/coverage-summary.json
|
||||||
|
delta: 0.3
|
||||||
|
fullCoverageDiff: true
|
||||||
|
|
||||||
|
build-frontend:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: contains(needs.setup.outputs.changes, 'frontend')
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
env:
|
||||||
|
FRONTEND_ENV: ${{ secrets.FRONTEND_ENV }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [16.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- 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@v4
|
||||||
|
with:
|
||||||
|
name: frontend-build
|
||||||
|
path: tdrive/frontend/build/
|
||||||
|
|
||||||
|
build-onlyoffice-connector:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: contains(needs.setup.outputs.changes, 'onlyoffice-connector')
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [16.x]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
- name: Install dependencies and build
|
||||||
|
run: |
|
||||||
|
cd tdrive/connectors/onlyoffice-connector
|
||||||
|
npm i
|
||||||
|
npm run build --if-present
|
||||||
|
npm run lint
|
||||||
|
|
||||||
|
build-ldap-sync:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
if: contains(needs.setup.outputs.changes, 'ldap-sync')
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Build ldap sync
|
||||||
|
run: cd tdrive/backend/utils/ldap-sync && npm i && npm run build
|
||||||
|
|
||||||
|
build-nextcloud-migration:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
if: contains(needs.setup.outputs.changes, 'nextcloud-migration')
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Build Nextcloud migration
|
||||||
|
run: cd tdrive/backend/utils/nextcloud-migration && npm i && npm run build
|
||||||
@@ -10,11 +10,11 @@ jobs:
|
|||||||
build-frontend:
|
build-frontend:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- run: cd tdrive && docker build -t tdrive/tdrive-frontend -f docker/tdrive-frontend/Dockerfile .
|
- run: cd tdrive && docker build -t tdrive/tdrive-frontend -f docker/tdrive-frontend/Dockerfile .
|
||||||
|
|
||||||
build-node:
|
build-node:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- run: cd tdrive && docker build --target production -t docker-registry.linagora.com/tdrive/tdrive-node -f docker/tdrive-node/Dockerfile .
|
- run: cd tdrive && docker build --target production -t docker-registry.linagora.com/tdrive/tdrive-node -f docker/tdrive-node/Dockerfile .
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Use Node.js 16
|
- name: Use Node.js 16
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 16
|
||||||
- run: npm install -g yarn
|
- run: npm install -g yarn
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
if: github.event.action == 'closed' && github.event.pull_request.merged == true
|
if: github.event.action == 'closed' && github.event.pull_request.merged == true
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions-ecosystem/action-add-labels@v1
|
- uses: actions-ecosystem/action-add-labels@v1
|
||||||
with:
|
with:
|
||||||
labels: "staging:develop"
|
labels: "staging:develop"
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
if: github.event.label.name == 'qa:ready' && github.event.pull_request.merged == true
|
if: github.event.label.name == 'qa:ready' && github.event.pull_request.merged == true
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: qa
|
ref: qa
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
if: github.event.label.name == 'canary:ready' && github.event.pull_request.merged == true
|
if: github.event.label.name == 'canary:ready' && github.event.pull_request.merged == true
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: canary
|
ref: canary
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -86,7 +86,7 @@ jobs:
|
|||||||
if: github.event.label.name == 'priority:1' && github.event.pull_request.merged == true
|
if: github.event.label.name == 'priority:1' && github.event.pull_request.merged == true
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: qa
|
ref: qa
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -97,7 +97,7 @@ jobs:
|
|||||||
git config user.email "labels-bot@github.com"
|
git config user.email "labels-bot@github.com"
|
||||||
git cherry-pick ${{github.event.pull_request.merge_commit_sha}}
|
git cherry-pick ${{github.event.pull_request.merge_commit_sha}}
|
||||||
git push
|
git push
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: canary
|
ref: canary
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -108,7 +108,7 @@ jobs:
|
|||||||
git config user.email "labels-bot@github.com"
|
git config user.email "labels-bot@github.com"
|
||||||
git cherry-pick ${{github.event.pull_request.merge_commit_sha}}
|
git cherry-pick ${{github.event.pull_request.merge_commit_sha}}
|
||||||
git push
|
git push
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
name: ldap-sync-build
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
paths:
|
|
||||||
- "tdrive/backend/utils/ldap-sync/**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ldap-sync-build:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Build ldap sync
|
|
||||||
run: cd tdrive/backend/utils/ldap-sync && npm i && npm run build
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
name: nextcloud-migration-build
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
paths:
|
|
||||||
- "tdrive/backend/utils/nextcloud-migration/**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ldap-sync-build:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Build ldap sync
|
|
||||||
run: cd tdrive/backend/utils/nextcloud-migration && npm i && npm run build
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
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 }}"
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
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 }}"
|
|
||||||
- name: Publish to dockerhub
|
|
||||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
|
||||||
with:
|
|
||||||
name: twakedrive/tdrive-frontend
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
||||||
workdir: tdrive
|
|
||||||
buildoptions: "-t twakedrive/tdrive-frontend -f docker/tdrive-frontend/Dockerfile"
|
|
||||||
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
name: publish-ldap-sync
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
paths:
|
|
||||||
- "tdrive/backend/utils/ldap-sync/**"
|
|
||||||
- "tdrive/docker/**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish-node:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- 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-ldap-sync
|
|
||||||
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-ldap-sync -f docker/tdrive-ldap-sync/Dockerfile"
|
|
||||||
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
name: publish-nextcloud-migration
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
paths:
|
|
||||||
- "tdrive/backend/utils/nextcloud-migration/**"
|
|
||||||
- "tdrive/docker/tdrive-nextcloud-migration/**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish-node:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- 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-nextcloud-migration
|
|
||||||
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-nextcloud-migration -f docker/tdrive-nextcloud-migration/Dockerfile"
|
|
||||||
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"
|
|
||||||
- name: Publish to dockerhub
|
|
||||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
|
||||||
with:
|
|
||||||
name: twakedrive/tdrive-nextcloud-migration
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
||||||
workdir: tdrive
|
|
||||||
context: .
|
|
||||||
target: production
|
|
||||||
buildoptions: "-t docker-registry.linagora.com/tdrive/tdrive-nextcloud-migration -f docker/tdrive-nextcloud-migration/Dockerfile"
|
|
||||||
tags: "${{ env.DOCKERTAG }},${{ env.DOCKERTAGVERSION }}"
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
name: publish-onlyoffice-connector
|
|
||||||
|
|
||||||
# Deploy onlyoffice-connector only if push on "main"
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
paths:
|
|
||||||
- "tdrive/docker/**"
|
|
||||||
- "tdrive/onlyoffice-connector/**"
|
|
||||||
- ".github/workflows/**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [16.x]
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
|
|
||||||
- name: Install dependencies and build
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
npm run build --if-present
|
|
||||||
npm run lint
|
|
||||||
working-directory: ./server
|
|
||||||
env:
|
|
||||||
CI: true
|
|
||||||
|
|
||||||
publish:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Publish to Registry
|
|
||||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
|
||||||
with:
|
|
||||||
name: tdrive/onlyoffice-connector
|
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
||||||
workdir: .
|
|
||||||
registry: docker-registry.linagora.com
|
|
||||||
context: .
|
|
||||||
target: production
|
|
||||||
buildoptions: "-t docker-registry.linagora.com/tdrive/onlyoffice-connector"
|
|
||||||
tags: "latest"
|
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
name: Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*.*.*"
|
||||||
|
paths:
|
||||||
|
- "tdrive/backend/node/**"
|
||||||
|
- "tdrive/frontend/**"
|
||||||
|
- "tdrive/connectors/onlyoffice-connector/**"
|
||||||
|
- "tdrive/backend/utils/ldap-sync/**"
|
||||||
|
- "tdrive/backend/utils/nextcloud-migration/**"
|
||||||
|
- "tdrive/docker/**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
name: Setup jobs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
targets: ${{ steps.filter.outputs.changes }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dorny/paths-filter@v3
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
backend:
|
||||||
|
- "tdrive/backend/node/**"
|
||||||
|
frontend:
|
||||||
|
- "tdrive/frontend/**"
|
||||||
|
onlyoffice-connector:
|
||||||
|
- "tdrive/connectors/onlyoffice-connector/**"
|
||||||
|
ldap-sync:
|
||||||
|
- "tdrive/backend/utils/ldap-sync/**"
|
||||||
|
nextcloud-migration:
|
||||||
|
- "tdrive/backend/utils/nextcloud-migration/**"
|
||||||
|
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
targets: ${{ fromJSON(needs.setup.outputs.targets) }}
|
||||||
|
fail-fast: false
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Login to Linagora Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: docker-registry.linagora.com
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./docker-bake.hcl
|
||||||
|
${{ steps.meta.outputs.bake-file-annotations }}
|
||||||
|
${{ steps.meta.outputs.bake-file }}
|
||||||
|
push: true
|
||||||
|
targets: ${{ matrix.targets }}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
function "generate_tags" {
|
||||||
|
params = [image, tags]
|
||||||
|
result = formatlist("%s:%s", image, tags)
|
||||||
|
}
|
||||||
|
|
||||||
|
target "docker-metadata-action" {}
|
||||||
|
|
||||||
|
target "_common" {
|
||||||
|
platforms = ["linux/amd64", "linux/arm64"]
|
||||||
|
context = "tdrive"
|
||||||
|
inherits = ["docker-metadata-action"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "backend" {
|
||||||
|
inherits = ["_common"]
|
||||||
|
dockerfile = "docker/tdrive-node/Dockerfile"
|
||||||
|
target = "production"
|
||||||
|
tags = concat(
|
||||||
|
generate_tags("docker.io/linagora/tdrive-node", target.docker-metadata-action.tags),
|
||||||
|
generate_tags("docker-registry.linagora.com/tdrive/tdrive-node", target.docker-metadata-action.tags),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
target "frontend" {
|
||||||
|
inherits = ["_common"]
|
||||||
|
dockerfile = "docker/tdrive-frontend/Dockerfile"
|
||||||
|
tags = concat(
|
||||||
|
generate_tags("docker.io/linagora/tdrive-frontend", target.docker-metadata-action.tags),
|
||||||
|
generate_tags("docker-registry.linagora.com/tdrive/tdrive-frontend", target.docker-metadata-action.tags),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
target "onlyoffice-connector" {
|
||||||
|
inherits = ["_common"]
|
||||||
|
dockerfile = "docker/onlyoffice-connector/Dockerfile"
|
||||||
|
tags = concat(
|
||||||
|
generate_tags("docker.io/linagora/onlyoffice-connector", target.docker-metadata-action.tags),
|
||||||
|
generate_tags("docker-registry.linagora.com/tdrive/onlyoffice-connector", target.docker-metadata-action.tags),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
target "ldap-sync" {
|
||||||
|
inherits = ["_common"]
|
||||||
|
dockerfile = "docker/tdrive-ldap-sync/Dockerfile"
|
||||||
|
tags = concat(
|
||||||
|
generate_tags("docker.io/linagora/tdrive-ldap-sync", target.docker-metadata-action.tags),
|
||||||
|
generate_tags("docker-registry.linagora.com/tdrive/tdrive-ldap-sync", target.docker-metadata-action.tags),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
target "nextcloud-migration" {
|
||||||
|
inherits = ["_common"]
|
||||||
|
dockerfile = "docker/tdrive-nextcloud-migration/Dockerfile"
|
||||||
|
tags = concat(
|
||||||
|
generate_tags("docker.io/linagora/tdrive-nextcloud-migration", target.docker-metadata-action.tags),
|
||||||
|
generate_tags("docker-registry.linagora.com/tdrive/tdrive-nextcloud-migration", target.docker-metadata-action.tags),
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user