diff --git a/.github/workflows/release-docker-v2.yml b/.github/workflows/release-docker-v2.yml new file mode 100644 index 0000000000..a19469e3f1 --- /dev/null +++ b/.github/workflows/release-docker-v2.yml @@ -0,0 +1,144 @@ +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/upgradeNocodbSdk2.js && + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js && + cd packages/nc-gui-v2 + 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/upgradeNcGui2.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 diff --git a/.github/workflows/release-npm-v2.yml b/.github/workflows/release-npm-v2.yml new file mode 100644 index 0000000000..3fa0b8e1ff --- /dev/null +++ b/.github/workflows/release-npm-v2.yml @@ -0,0 +1,93 @@ +name: "Release : NPM packages (v2)" + +on: + # Triggered manually + workflow_dispatch: + inputs: + tag: + description: "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: "Tag" + required: true + type: string + targetEnv: + description: "Target Environment" + required: true + type: string + secrets: + NPM_TOKEN: + required: true +# GITHUB_TOKEN: +# required: true + +jobs: + release: + runs-on: ubuntu-latest + env: + working-directory: ./packages/nocodb + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: ${{ github.ref }} + - name: NPM Setup and Publish with 16.15.0 + # Setup .npmrc file to publish to npm + uses: actions/setup-node@v2 + with: + node-version: 16.15.0 + registry-url: 'https://registry.npmjs.org' + - run: | + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js && + cd packages/nocodb-sdk && + npm ci && npm run build && npm publish && + cd ../.. && + sleep 60 && + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk2.js && + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js && + cd packages/nc-gui-v2 && + npm ci && + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy:publish && + cd ../.. && + sleep 60 && + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui2.js && cd packages/nocodb && npm install && npm run obfuscate:build:publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Create Pull Request + if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }} + id: cpr + uses: peter-evans/create-pull-request@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # commit-message: Update report + # committer: GitHub + # author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> + signoff: true + branch: 'release/${{ github.event.inputs.tag || inputs.tag }}' + delete-branch: true + title: 'Release ${{ github.event.inputs.tag || inputs.tag }}' + labels: 'Bot: Automerge' + - name: Check outputs + if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }} + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" + - name: automerge + if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }} + uses: "pascalgn/automerge-action@v0.14.3" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + PULL_REQUEST: "${{ steps.cpr.outputs.pull-request-number }}" + MERGE_LABELS: "Bot: Automerge" diff --git a/.github/workflows/release-pr-v2.yml b/.github/workflows/release-pr-v2.yml new file mode 100644 index 0000000000..f071b08120 --- /dev/null +++ b/.github/workflows/release-pr-v2.yml @@ -0,0 +1,126 @@ +name: 'PR Release (v2)' + +on: + pull_request: + # opened: pull request is created + # reopened: closed pull request is reopened + # synchronize: commit(s) pushed to the pull request + # ready_for_review: non PR release + types: [opened, reopened, synchronize, ready_for_review] + paths: + # - "packages/nocodb-sdk/**" + - "packages/nc-gui-v2/**" + # - "packages/nc-plugin/**" + # - "packages/nocodb/**" +jobs: + # enrich tag for pr release + set-tag: + if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} + runs-on: 'ubuntu-latest' + steps: + - name: set-tag + id: tag-step + run: | + # Get current date + CURRENT_DATE=$(date +"%Y%m%d") + CURRENT_TIME=$(date +"%H%M") + # Get current PR number + PR_NUMBER=${{github.event.number}} + # Get current version + CURRENT_VERSION=$(basename $(curl -fs -o/dev/null -w %{redirect_url} https://github.com/nocodb/nocodb/releases/latest)) + # Construct tag name + TAG_NAME=pr-${PR_NUMBER}-${CURRENT_DATE}-${CURRENT_TIME} + echo "::set-output name=TARGET_TAG::${TAG_NAME}" + echo "::set-output name=CURRENT_VERSION::${CURRENT_VERSION}" + - name: verify-tag + run: | + echo ${{ steps.tag-step.outputs.TARGET_TAG }} + echo ${{ steps.tag-step.outputs.CURRENT_VERSION }} + outputs: + target_tag: ${{ steps.tag-step.outputs.TARGET_TAG }} + current_version: ${{ steps.tag-step.outputs.CURRENT_VERSION }} + + # Build, install, publish frontend and backend to npm + release-npm: + if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} + needs: [set-tag] + uses: ./.github/workflows/release-npm-v2.yml + with: + tag: ${{ needs.set-tag.outputs.target_tag }} + targetEnv: 'DEV' + secrets: + NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" + + # Build docker image and push to docker hub + release-docker: + if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} + needs: [release-npm, set-tag] + uses: ./.github/workflows/release-docker-v2.yml + with: + currentVersion: ${{ needs.set-tag.outputs.current_version }} + tag: ${{ needs.set-tag.outputs.target_tag }} + targetEnv: 'DEV' + isDaily: 'N' + secrets: + DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}" + DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}" + + # Build executables and publish to GitHub + # release-executables: + # if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} + # needs: [set-tag, release-npm] + # uses: ./.github/workflows/release-timely-executables.yml + # with: + # tag: ${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }} + # secrets: + # NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}" + + # Add a comment for PR docker build + leave-comment: + if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} + runs-on: 'ubuntu-latest' + needs: [release-docker, set-tag] + steps: + - uses: peter-evans/commit-comment@v2 + with: + body: | + The PR changes have been deployed. Please 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 }} + ``` + + # Add a comment for PR executable build + # leave-executable-comment: + # if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} + # runs-on: 'ubuntu-latest' + # needs: [release-executables, set-tag] + # steps: + # - uses: peter-evans/commit-comment@v2 + # with: + # body: | + # ### Run Executables + + # #### MacOS + + # ```bash + # mkdir -p ./${{ needs.set-tag.outputs.current_version }}/${{ needs.set-tag.outputs.target_tag }} && cd "$_" \ + # && curl http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-macos-arm64 -o noco -L \ + # && chmod +x noco \ + # && ./noco + # ``` + # #### Linux + + # ```bash + # mkdir -p ./${{ needs.set-tag.outputs.current_version }}/${{ needs.set-tag.outputs.target_tag }} && cd "$_" \ + # && curl http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-linux-x64 -o noco -L \ + # && chmod +x noco \ + # && ./noco + # ``` + # #### Windows + + # ```bash + # iwp http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-win-arm64.exe + # .\Noco-win-arm64.exe + # ``` + + # For executables visit [here](https://github.com/nocodb/nocodb-timely/releases/tag/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}) diff --git a/packages/nc-gui-v2/components/dlg/AirtableImport.vue b/packages/nc-gui-v2/components/dlg/AirtableImport.vue index 9a33b64d73..13843156fc 100644 --- a/packages/nc-gui-v2/components/dlg/AirtableImport.vue +++ b/packages/nc-gui-v2/components/dlg/AirtableImport.vue @@ -11,6 +11,7 @@ import { onBeforeUnmount, onMounted, ref, + useGlobal, useNuxtApp, useProject, watch, @@ -24,8 +25,9 @@ const { modelValue } = defineProps() const emit = defineEmits(['update:modelValue']) -// TODO: handle baseURL -const baseURL = 'http://localhost:8080' // this.$axios.defaults.baseURL +const { appInfo } = $(useGlobal()) + +const baseURL = appInfo.ncSiteUrl const { $state } = useNuxtApp() diff --git a/packages/nc-gui-v2/components/general/Share.vue b/packages/nc-gui-v2/components/general/Share.vue index dfb908e93f..28a8179f90 100644 --- a/packages/nc-gui-v2/components/general/Share.vue +++ b/packages/nc-gui-v2/components/general/Share.vue @@ -52,7 +52,7 @@ const openUrl = (url: string) => { @click.prevent="openUrl(`https://twitter.com/intent/tweet?url=${shareUrl}&text=${encodedSummary}&hashtags=${hashTags}`)" > Twitter { " > Linkedin { " > Facebook { class="px-2" @click.prevent="openUrl(`https://www.reddit.com/submit?url=${shareUrl}&title=${encodedSummary}`)" > - Reddit + Reddit { @click.prevent="openUrl(`https://pinterest.com/pin/create/button/?url=${shareUrl}&description==${encodedSummary}`)" > Printrest { @click.prevent="openUrl(`https://api.whatsapp.com/send?text=${encodedSummary}%0D%0A${shareUrl}`)" > Whatsapp { @click.prevent="openUrl(`https://telegram.me/share/url?url=${shareUrl}&text=${encodedSummary}`)" > Telegram { @click.prevent="openUrl(`https://www.addtoany.com/add_to/wechat?linkurl=${shareUrl}&linkname=${encodedTitle}`)" > Wechat { Line { class="px-2" > Odnoklassniki { @click.prevent="openUrl(`http://service.weibo.com/share/share.php?url=${shareUrl})&title=${encodedTitle}`)" > Weibo { " > Renren { @click.prevent="openUrl(`http://www.douban.com/recommend/?url=${shareUrl}&title=${encodedTitle}`)" > Douban { openUrl(`https://vk.com/share.php?url=${shareUrl})&title=${encodedTitle}&description=${encodedSummary}&noparse=true`) " > - VK + VK { @click.prevent="openUrl(`https://www.addtoany.com/add_to/wykop?linkurl=${shareUrl}&linkname=${encodedTitle}`)" > Wykop()