👷 Workflow to publish dev and feature branches (#457)
The workflow to publish docker images for main branch and for branches with name starting with "feature-"
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
name: Publish Feature Brunch
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- feature-**
|
||||
|
||||
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-feature:
|
||||
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: Echo
|
||||
run: echo Publish images with tag ${{ github.head_ref || github.ref_name }}
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
tags: |
|
||||
${{ github.head_ref || github.ref_name }}
|
||||
|
||||
- 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 }}
|
||||
@@ -20,7 +20,7 @@ if (process.env.CI || localDevTests.length === 0) {
|
||||
if (localDevTests) {
|
||||
console.log("Only this tests will be run:", localDevTests);
|
||||
} else {
|
||||
console.log("Will run all the tests");
|
||||
console.log("Will run all the tests.");
|
||||
}
|
||||
|
||||
function exec(command, args, debug = false) {
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* This file replace version in code
|
||||
*/
|
||||
|
||||
const versions = {
|
||||
VERSION_NAME: process.env.Tdrive_VERSION_NAME || "Albatros",
|
||||
VERSION: process.env.Tdrive_VERSION || "2023.Q1",
|
||||
VERSION_DETAIL: process.env.Tdrive_VERSION_DETAIL || "2023.Q1.1223",
|
||||
MIN_VERSION_WEB: process.env.Tdrive_MIN_VERSION_WEB || "2022.Q2.975",
|
||||
MIN_VERSION_MOBILE: process.env.Tdrive_MIN_VERSION_MOBILE || "2022.Q2.975",
|
||||
};
|
||||
|
||||
const files = [
|
||||
"frontend/src/app/environment/version.ts",
|
||||
"backend/node/src/version.ts",
|
||||
"../.github/workflows/publish-backend.yml",
|
||||
"../.github/workflows/publish-frontend.yml",
|
||||
];
|
||||
|
||||
var fs = require("fs");
|
||||
|
||||
files.forEach((file) => {
|
||||
fs.readFile(file, "utf8", function (err, data) {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
}
|
||||
|
||||
var result = data;
|
||||
|
||||
Object.keys(versions).forEach((k) => {
|
||||
const replacement = versions[k];
|
||||
result = result.replace(
|
||||
new RegExp("( @" + k + " .*')[a-zA-Z0-9.]*(')", "g"),
|
||||
"$1" + replacement + "$2"
|
||||
);
|
||||
result = result.replace(
|
||||
new RegExp("( @" + k + ' .*")[a-zA-Z0-9.]*(")', "g"),
|
||||
"$1" + replacement + "$2"
|
||||
);
|
||||
});
|
||||
|
||||
result = result.replace(
|
||||
new RegExp('(DOCKERTAGVERSION=)[a-zA-Z0-9.]*(")', "g"),
|
||||
"$1" + versions.VERSION_DETAIL + "$2"
|
||||
);
|
||||
|
||||
fs.writeFile(file, result, "utf8", function (err) {
|
||||
if (err) return console.log(err);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user