mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
4.9 KiB
144 lines
4.9 KiB
2 years ago
|
name: "Release : Docker (v2)"
|
||
|
|
||
|
on:
|
||
|
# Triggered manually
|
||
|
workflow_dispatch:
|
||
|
inputs:
|
||
|
tag:
|
||
|
description: "Docker image tag"
|
||
|
required: true
|
||
|
targetEnv:
|
||
|
description: "Target Environment"
|
||
|
required: true
|
||
|
type: choice
|
||
|
options:
|
||
|
- DEV
|
||
|
- PROD
|
||
|
# Triggered by release-nocodb.yml / release-nightly-dev.yml / release-pr.yml
|
||
|
workflow_call:
|
||
|
inputs:
|
||
|
tag:
|
||
|
description: "Docker image tag"
|
||
|
required: true
|
||
|
type: string
|
||
|
targetEnv:
|
||
|
description: "Target Environment"
|
||
|
required: true
|
||
|
type: string
|
||
|
isDaily:
|
||
|
description: "Is it triggered by daily schedule"
|
||
|
required: false
|
||
|
type: string
|
||
|
currentVersion:
|
||
|
description: "The current NocoDB version"
|
||
|
required: false
|
||
|
type: string
|
||
|
secrets:
|
||
|
DOCKERHUB_USERNAME:
|
||
|
required: true
|
||
|
DOCKERHUB_TOKEN:
|
||
|
required: true
|
||
|
|
||
|
jobs:
|
||
|
buildx:
|
||
|
runs-on: ubuntu-latest
|
||
|
env:
|
||
|
working-directory: ./packages/nocodb
|
||
|
steps:
|
||
|
- name: Get Docker Repository
|
||
|
id: get-docker-repository
|
||
|
run: |
|
||
|
DOCKER_REPOSITORY=nocodb
|
||
|
DOCKER_BUILD_TAG=${{ github.event.inputs.tag || inputs.tag }}
|
||
|
if [[ ${{ github.event.inputs.targetEnv || inputs.targetEnv }} == 'DEV' ]]; then
|
||
|
if [[ ${{ github.event.inputs.currentVersion || inputs.currentVersion || 'N/A' }} != 'N/A' ]]; then
|
||
|
DOCKER_BUILD_TAG=${{ github.event.inputs.currentVersion || inputs.currentVersion }}-${{ github.event.inputs.tag || inputs.tag }}
|
||
|
fi
|
||
|
if [[ ${{ inputs.isDaily || 'N' }} == 'Y' ]]; then
|
||
|
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-daily
|
||
|
else
|
||
|
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-timely
|
||
|
fi
|
||
|
fi
|
||
|
echo "::set-output name=DOCKER_REPOSITORY::${DOCKER_REPOSITORY}"
|
||
|
echo "::set-output name=DOCKER_BUILD_TAG::${DOCKER_BUILD_TAG}"
|
||
|
echo ${DOCKER_REPOSITORY}
|
||
|
echo ${DOCKER_BUILD_TAG}
|
||
|
|
||
|
- name: Checkout
|
||
|
uses: actions/checkout@v2
|
||
|
with:
|
||
|
fetch-depth: 0
|
||
|
ref: ${{ github.ref }}
|
||
|
|
||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||
|
uses: actions/setup-node@v2
|
||
|
with:
|
||
|
node-version: 16.15.0
|
||
|
|
||
|
- name: upgrade packages for nightly build or pr build
|
||
|
if: ${{ github.event.inputs.targetEnv == 'DEV' || inputs.targetEnv == 'DEV' }}
|
||
|
run: |
|
||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js
|
||
|
cd packages/nocodb-sdk
|
||
|
npm install && npm run build
|
||
|
cd ../..
|
||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk.js
|
||
|
cd packages/nc-gui
|
||
|
npm install
|
||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy
|
||
|
cd ../..
|
||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui.js
|
||
|
|
||
|
- uses: bahmutov/npm-install@v1
|
||
|
with:
|
||
|
working-directory: ${{ env.working-directory }}
|
||
|
|
||
|
- name: Build nocodb and docker files
|
||
|
run: |
|
||
|
npm run build
|
||
|
npm run docker:build
|
||
|
working-directory: ${{ env.working-directory }}
|
||
|
|
||
|
- name: Set up QEMU
|
||
|
uses: docker/setup-qemu-action@v1
|
||
|
|
||
|
- name: Set up Docker Buildx
|
||
|
id: buildx
|
||
|
uses: docker/setup-buildx-action@v1
|
||
|
|
||
|
- name: Cache Docker layers
|
||
|
uses: actions/cache@v2
|
||
|
with:
|
||
|
path: /tmp/.buildx-cache
|
||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||
|
restore-keys: |
|
||
|
${{ runner.os }}-buildx-
|
||
|
|
||
|
- name: Login to DockerHub
|
||
|
uses: docker/login-action@v1
|
||
|
with:
|
||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||
|
|
||
|
- name: Build and push
|
||
|
uses: docker/build-push-action@v2
|
||
|
with:
|
||
|
context: ${{ env.working-directory }}
|
||
|
build-args: NC_VERSION=${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }}
|
||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||
|
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||
|
push: true
|
||
|
tags: |
|
||
|
nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }}
|
||
|
nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:latest
|
||
|
|
||
|
# Temp fix
|
||
|
# https://github.com/docker/build-push-action/issues/252
|
||
|
# https://github.com/moby/buildkit/issues/1896
|
||
|
- name: Move cache
|
||
|
run: |
|
||
|
rm -rf /tmp/.buildx-cache
|
||
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|