Browse Source

fix: docker version & enable leave-comment

pull/1926/head
Wing-Kam Wong 3 years ago
parent
commit
b1aefa9927
  1. 14
      .github/workflows/release-docker.yml
  2. 5
      .github/workflows/release-nightly-dev.yml
  3. 30
      .github/workflows/release-pr.yml

14
.github/workflows/release-docker.yml

@ -29,6 +29,10 @@ on:
description: "Is it triggered by daily schedule" description: "Is it triggered by daily schedule"
required: false required: false
type: string type: string
currentVersion:
description: "The current NocoDB version"
required: false
type: string
secrets: secrets:
DOCKERHUB_USERNAME: DOCKERHUB_USERNAME:
required: true required: true
@ -48,7 +52,11 @@ jobs:
id: get-docker-repository id: get-docker-repository
run: | run: |
DOCKER_REPOSITORY=nocodb 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.targetEnv || inputs.targetEnv }} == 'DEV' ]]; then
if [[ ${{ github.event.inputs.currentVersion || inputs.currentVersion }} != '' ]]; then
DOCKER_BUILD_TAG=${{ github.event.inputs.currentVersion || inputs.currentVersion }}-${{ github.event.inputs.tag || inputs.tag }}
fi
if [[ ${{ inputs.isDaily || 'N' }} == 'Y' ]]; then if [[ ${{ inputs.isDaily || 'N' }} == 'Y' ]]; then
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-daily DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-daily
else else
@ -56,7 +64,9 @@ jobs:
fi fi
fi fi
echo "::set-output name=DOCKER_REPOSITORY::${DOCKER_REPOSITORY}" echo "::set-output name=DOCKER_REPOSITORY::${DOCKER_REPOSITORY}"
echo "::set-output name=DOCKER_BUILD_TAG::${DOCKER_BUILD_TAG}"
echo ${DOCKER_REPOSITORY} echo ${DOCKER_REPOSITORY}
echo ${DOCKER_BUILD_TAG}
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -118,13 +128,13 @@ jobs:
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: ${{ env.working-directory }} context: ${{ env.working-directory }}
build-args: NC_VERSION=${{ github.event.inputs.tag || inputs.tag }} build-args: NC_VERSION=${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }}
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new cache-to: type=local,dest=/tmp/.buildx-cache-new
push: true push: true
tags: | tags: |
nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:${{ github.event.inputs.tag || inputs.tag }} 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 nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:latest
# Temp fix # Temp fix

5
.github/workflows/release-nightly-dev.yml

@ -28,6 +28,8 @@ jobs:
CURRENT_TIME=$(date +"%H%M") CURRENT_TIME=$(date +"%H%M")
TAG_NAME=${CURRENT_DATE}-${CURRENT_TIME} TAG_NAME=${CURRENT_DATE}-${CURRENT_TIME}
IS_DAILY='Y' IS_DAILY='Y'
# Get current version
CURRENT_VERSION=$(basename $(curl -fs -o/dev/null -w %{redirect_url} https://github.com/nocodb/nocodb/releases/latest))
# Set the tag # Set the tag
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
TAG_NAME=${TAG_NAME} TAG_NAME=${TAG_NAME}
@ -40,9 +42,11 @@ jobs:
run: | run: |
echo ${{ steps.tag-step.outputs.NIGHTLY_BUILD_TAG }} echo ${{ steps.tag-step.outputs.NIGHTLY_BUILD_TAG }}
echo ${{ steps.tag-step.outputs.IS_DAILY }} echo ${{ steps.tag-step.outputs.IS_DAILY }}
echo ${{ steps.tag-step.outputs.CURRENT_VERSION }}
outputs: outputs:
nightly_build_tag: ${{ steps.tag-step.outputs.NIGHTLY_BUILD_TAG }} nightly_build_tag: ${{ steps.tag-step.outputs.NIGHTLY_BUILD_TAG }}
is_daily: ${{ steps.tag-step.outputs.IS_DAILY }} is_daily: ${{ steps.tag-step.outputs.IS_DAILY }}
current_version: ${{ steps.tag-step.outputs.CURRENT_VERSION }}
# Build frontend and backend and publish to npm # Build frontend and backend and publish to npm
release-npm: release-npm:
needs: set-tag needs: set-tag
@ -58,6 +62,7 @@ jobs:
needs: [set-tag, release-npm] needs: [set-tag, release-npm]
uses: ./.github/workflows/release-docker.yml uses: ./.github/workflows/release-docker.yml
with: with:
currentVersion: ${{ needs.set-tag.outputs.current_version }}
tag: ${{ needs.set-tag.outputs.nightly_build_tag }} tag: ${{ needs.set-tag.outputs.nightly_build_tag }}
targetEnv: ${{ github.event.inputs.targetEnv || 'DEV' }} targetEnv: ${{ github.event.inputs.targetEnv || 'DEV' }}
isDaily: ${{ needs.set-tag.outputs.is_daily }} isDaily: ${{ needs.set-tag.outputs.is_daily }}

30
.github/workflows/release-pr.yml

@ -64,6 +64,7 @@ jobs:
needs: [release-npm, set-tag] needs: [release-npm, set-tag]
uses: ./.github/workflows/release-docker.yml uses: ./.github/workflows/release-docker.yml
with: with:
currentVersion: ${{ needs.set-tag.outputs.current_version }}
tag: ${{ needs.set-tag.outputs.target_tag }} tag: ${{ needs.set-tag.outputs.target_tag }}
targetEnv: 'DEV' targetEnv: 'DEV'
isDaily: 'N' isDaily: 'N'
@ -71,25 +72,24 @@ jobs:
DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}" DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}"
DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}" DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}"
leave-comment:
runs-on: 'ubuntu-latest'
needs: [release-docker, set-tag]
steps:
- run: |
echo docker run -d -p 8888:8080 nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
# Uncomment it after testing
# leave-comment: # leave-comment:
# runs-on: 'ubuntu-latest' # runs-on: 'ubuntu-latest'
# needs: [release-docker, set-tag] # needs: [release-docker, set-tag]
# steps: # steps:
# - uses: peter-evans/commit-comment@v2 # - run: |
# with: # echo docker run -d -p 8888:8080 nocodb/nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
# body: |
# The PR changes have been deployed. Pleae run the following command to verify: leave-comment:
# ``` runs-on: 'ubuntu-latest'
# docker run -d -p 8888:8080 nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }} needs: [release-docker, set-tag]
# ``` steps:
- uses: peter-evans/commit-comment@v2
with:
body: |
The PR changes have been deployed. Pleae run the following command to verify:
```
docker run -d -p 8888:8080 nocodb/nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
```
# if-merged: # if-merged:
# if: github.event.pull_request.merged == true # if: github.event.pull_request.merged == true

Loading…
Cancel
Save