From 70bba0fde58bf6e43583a2b924151b74d7c2d253 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 16 Feb 2022 16:06:32 +0800 Subject: [PATCH 1/9] refactor: release workflows Signed-off-by: Wing-Kam Wong --- .github/workflows/release-close-issue.yml | 26 +++++ .github/workflows/release-docker.yml | 12 ++- .github/workflows/release-draft.yml | 16 +++- .github/workflows/release-npm.yml | 110 ++-------------------- 4 files changed, 60 insertions(+), 104 deletions(-) create mode 100644 .github/workflows/release-close-issue.yml diff --git a/.github/workflows/release-close-issue.yml b/.github/workflows/release-close-issue.yml new file mode 100644 index 0000000000..bfa06021e6 --- /dev/null +++ b/.github/workflows/release-close-issue.yml @@ -0,0 +1,26 @@ +name: 'Close Issues with Labels' + +on: + # Triggered manually + workflow_dispatch: + inputs: + issue_label: + description: "All issues with such label will be closed" + required: true + # Triggered by release-nocodb.yml + workflow_call: + inputs: + issue_label: + description: "All issues with such label will be closed" + required: true + type: string +jobs: + close-issues: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: close-resolved-issues + uses: bdougie/close-issues-based-on-label@master + env: + LABEL: ${{ github.event.inputs.issue_label || inputs.issue_label }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index c8e094a8f8..1efc14d9ba 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -1,11 +1,19 @@ name: "Release : Docker" on: + # Triggered manually workflow_dispatch: inputs: tag: description: "Docker image tag" required: true + # Triggered by release-nocodb.yml + workflow_call: + inputs: + tag: + description: "Docker image tag" + required: true + type: string jobs: buildx: @@ -59,13 +67,13 @@ jobs: uses: docker/build-push-action@v2 with: context: ${{ env.working-directory }} - build-args: NC_VERSION=${{ github.event.inputs.tag }} + build-args: NC_VERSION=${{ github.event.inputs.tag || inputs.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/nocodb:${{ github.event.inputs.tag }} + nocodb/nocodb:${{ github.event.inputs.tag || inputs.tag }} nocodb/nocodb:latest # Temp fix diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml index dc57ee6389..8f0228b615 100644 --- a/.github/workflows/release-draft.yml +++ b/.github/workflows/release-draft.yml @@ -1,6 +1,7 @@ name: "Release : Draft Notes" on: + # Triggered manually workflow_dispatch: inputs: tag: @@ -9,6 +10,17 @@ on: prev_tag: description: "Previous Tag" required: true + # Triggered by release-nocodb.yml + workflow_call: + inputs: + tag: + description: "Tag" + required: true + type: string + prev_tag: + description: "Previous Tag" + required: true + type: string jobs: build: @@ -22,7 +34,7 @@ jobs: github.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, - ref: "refs/tags/${{ github.event.inputs.tag }}", + ref: "refs/tags/${{ github.event.inputs.tag || inputs.tag }} ", sha: context.sha }) @@ -33,4 +45,4 @@ jobs: - uses: actions/setup-node@v2 with: node-version: 14 - - run: "npx github-release-notes@0.17.2 release --token ${{ secrets.GH_TOKEN }} --draft --tags ${{ github.event.inputs.tag }}..${{ github.event.inputs.prev_tag }}" + - run: "npx github-release-notes@0.17.2 release --token ${{ secrets.GH_TOKEN }} --draft --tags ${{ github.event.inputs.tag || inputs.tag }}..${{ github.event.inputs.prev_tag || inputs.prev_tag }} " diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index 200b7e5782..db4dd43011 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -1,15 +1,19 @@ name: "Release : NPM packages" on: + # Triggered manually workflow_dispatch: inputs: tag: description: "Tag" required: true - prev_tag: - description: "Previous Tag" + type: string + # Triggered by release-nocodb.yml + workflow_call: + inputs: + tag: + description: "Tag" required: true - jobs: release: runs-on: ubuntu-latest @@ -31,7 +35,7 @@ jobs: npm run build:copy:jsdeliver cd ../.. npm install - VERSION=${{github.event.inputs.tag}} node scripts/upgradeNcGui.js node scripts/upgradeNcGui.js && cd packages/nocodb && npm run obfuscate:build:publish + VERSION=${{ github.event.inputs.tag || inputs.tag }} node scripts/upgradeNcGui.js node scripts/upgradeNcGui.js && cd packages/nocodb && npm run obfuscate:build:publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Create Pull Request @@ -46,7 +50,7 @@ jobs: signoff: true branch: release-patches delete-branch: true - title: 'Release ${{github.event.inputs.tag}}' + title: 'Release ${{ github.event.inputs.tag || inputs.tag }}' labels: | automerge @@ -59,98 +63,4 @@ jobs: uses: "pascalgn/automerge-action@v0.14.3" env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PULL_REQUEST: "${{ steps.cpr.outputs.pull-request-number }}" - buildx: - runs-on: ubuntu-latest - needs: [release] - env: - working-directory: ./packages/nocodb - strategy: - matrix: - node-version: [ 12 ] - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - - 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=${{ github.event.inputs.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/nocodb:${{ github.event.inputs.tag }} - nocodb/nocodb: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 - draft: - runs-on: ubuntu-latest - needs: [release] - steps: - - name: Create tag - uses: actions/github-script@v3 - with: - github-token: ${{ secrets.GH_TOKEN }} - script: | - github.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: "refs/tags/${{ github.event.inputs.tag }}", - sha: context.sha - }) - - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v2 - with: - node-version: 14 - - run: "npx github-release-notes@0.17.2 release --token ${{ secrets.GH_TOKEN }} --draft --tags ${{ github.event.inputs.tag }}..${{ github.event.inputs.prev_tag }}" - - + PULL_REQUEST: "${{ steps.cpr.outputs.pull-request-number }}" \ No newline at end of file From 9c0aa3257ec39011876a8de56db8399d20a25b7a Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 16 Feb 2022 16:07:08 +0800 Subject: [PATCH 2/9] init: master release workflow Signed-off-by: Wing-Kam Wong --- .github/workflows/release-nocodb.yml | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/release-nocodb.yml diff --git a/.github/workflows/release-nocodb.yml b/.github/workflows/release-nocodb.yml new file mode 100644 index 0000000000..7d9a0f8561 --- /dev/null +++ b/.github/workflows/release-nocodb.yml @@ -0,0 +1,40 @@ +name: 'NocoDB Release' + +on: + # Triggered manually + workflow_dispatch: + inputs: + tag: + description: "Target Tag" + required: true + prev_tag: + description: "Previous Tag" + required: true +jobs: + # Build, install, publish frontend and backend to npm + release-npm: + uses: ./.github/workflows/release-npm.yml + with: + tag: tag + # Close all issues with target tags 'Fixed' & 'Resolved' + # TODO: add 'Fixed in vX.Y.Z' comment after closing. + close-fixed-issues: + needs: release-npm + uses: ./.github/workflows/release-close-issue.yml + with: + issue_label: 'Fixed' + close-resolved-issues: + needs: close-fixed-issues + uses: ./.github/workflows/release-close-issue.yml + with: + issue_label: 'Resolved' + # Draft Release Note + release-draft-note: + needs: close-issues + users: ./.github/workflows/release-draft.yml + # Build docker image and push to docker hub + release-docker: + needs: release-draft-note + users: ./.gitjib/workflows/release-docker.yml + with: + tag: tag From 7eafd83d8ffe3deee545cb2e73b07224ad58960f Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 16 Feb 2022 19:27:38 +0800 Subject: [PATCH 3/9] fix: PR settings in release-npm.yml Signed-off-by: Wing-Kam Wong --- .github/workflows/release-npm.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index db4dd43011..d968a40a9d 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -48,19 +48,13 @@ jobs: # committer: GitHub # author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> signoff: true - branch: release-patches + branch: 'release/${{ github.event.inputs.tag || inputs.tag }}' delete-branch: true title: 'Release ${{ github.event.inputs.tag || inputs.tag }}' + reviewers: o1lab,pranavcx,dstala,wingkwong labels: | - automerge - + Bot: Automated PR - name: Check outputs run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" - - - name: automerge - uses: "pascalgn/automerge-action@v0.14.3" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PULL_REQUEST: "${{ steps.cpr.outputs.pull-request-number }}" \ No newline at end of file + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" \ No newline at end of file From 6b3bd4407a230007feb7147849c30af43e758b7c Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 16 Feb 2022 19:33:44 +0800 Subject: [PATCH 4/9] fix: add missing input for release-draft-note Signed-off-by: Wing-Kam Wong --- .github/workflows/release-nocodb.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release-nocodb.yml b/.github/workflows/release-nocodb.yml index 7d9a0f8561..cc6968ff54 100644 --- a/.github/workflows/release-nocodb.yml +++ b/.github/workflows/release-nocodb.yml @@ -32,6 +32,9 @@ jobs: release-draft-note: needs: close-issues users: ./.github/workflows/release-draft.yml + with: + tag: tag + prev_tag: prev_tag # Build docker image and push to docker hub release-docker: needs: release-draft-note From aba69dc78ec092f83587195c5f276fec1e86116e Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 16 Feb 2022 20:13:01 +0800 Subject: [PATCH 5/9] fix: add automerge Signed-off-by: Wing-Kam Wong --- .github/workflows/release-npm.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index d968a40a9d..6a9646791a 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -51,10 +51,14 @@ jobs: branch: 'release/${{ github.event.inputs.tag || inputs.tag }}' delete-branch: true title: 'Release ${{ github.event.inputs.tag || inputs.tag }}' - reviewers: o1lab,pranavcx,dstala,wingkwong labels: | Bot: Automated PR - name: Check outputs run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" \ No newline at end of file + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" + - name: automerge + uses: "pascalgn/automerge-action@v0.14.3" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + PULL_REQUEST: "${{ steps.cpr.outputs.pull-request-number }}" \ No newline at end of file From e2aa54701f648fc83dd59b37a8d9da08fdc56df5 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 16 Feb 2022 20:13:41 +0800 Subject: [PATCH 6/9] feat: add sync-to-develop Signed-off-by: Wing-Kam Wong --- .github/workflows/release-nocodb.yml | 22 +++++++++++++++------- .github/workflows/sync-to-develop.yml | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/sync-to-develop.yml diff --git a/.github/workflows/release-nocodb.yml b/.github/workflows/release-nocodb.yml index cc6968ff54..908b2dac30 100644 --- a/.github/workflows/release-nocodb.yml +++ b/.github/workflows/release-nocodb.yml @@ -11,11 +11,6 @@ on: description: "Previous Tag" required: true jobs: - # Build, install, publish frontend and backend to npm - release-npm: - uses: ./.github/workflows/release-npm.yml - with: - tag: tag # Close all issues with target tags 'Fixed' & 'Resolved' # TODO: add 'Fixed in vX.Y.Z' comment after closing. close-fixed-issues: @@ -28,16 +23,29 @@ jobs: uses: ./.github/workflows/release-close-issue.yml with: issue_label: 'Resolved' + + # Build, install, publish frontend and backend to npm + release-npm: + uses: ./.github/workflows/release-npm.yml + with: + tag: tag + # Draft Release Note release-draft-note: needs: close-issues - users: ./.github/workflows/release-draft.yml + uses: ./.github/workflows/release-draft.yml with: tag: tag prev_tag: prev_tag + # Build docker image and push to docker hub release-docker: needs: release-draft-note - users: ./.gitjib/workflows/release-docker.yml + uses: ./.github/workflows/release-docker.yml with: tag: tag + + # Sync changes to develop + sync-to-develop: + needs: release-docker + uses: ./.github/workflows/sync-to-develop.yml \ No newline at end of file diff --git a/.github/workflows/sync-to-develop.yml b/.github/workflows/sync-to-develop.yml new file mode 100644 index 0000000000..74fa9837ec --- /dev/null +++ b/.github/workflows/sync-to-develop.yml @@ -0,0 +1,20 @@ +name: 'Sync changes back to develop branch' + +on: + # Triggered manually + workflow_dispatch: + # Triggered by release-nocodb.yml + workflow_call: +jobs: + close-issues: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - name: Merge master -> develop + uses: devmasx/merge-branch@master + with: + type: now + from_branch: master + target_branch: develop + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From bb7f3e38c4e6bc64ebbc3513ecfe27978f8cf42b Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 17 Feb 2022 12:16:48 +0800 Subject: [PATCH 7/9] fix: variable syntax & pass version to release-close-issue Signed-off-by: Wing-Kam Wong --- .github/workflows/release-nocodb.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-nocodb.yml b/.github/workflows/release-nocodb.yml index 908b2dac30..5f427fb0a5 100644 --- a/.github/workflows/release-nocodb.yml +++ b/.github/workflows/release-nocodb.yml @@ -12,38 +12,39 @@ on: required: true jobs: # Close all issues with target tags 'Fixed' & 'Resolved' - # TODO: add 'Fixed in vX.Y.Z' comment after closing. close-fixed-issues: needs: release-npm uses: ./.github/workflows/release-close-issue.yml with: issue_label: 'Fixed' + version: ${{ github.event.inputs.tag }} close-resolved-issues: needs: close-fixed-issues uses: ./.github/workflows/release-close-issue.yml with: issue_label: 'Resolved' + version: ${{ github.event.inputs.tag }} # Build, install, publish frontend and backend to npm release-npm: uses: ./.github/workflows/release-npm.yml with: - tag: tag + tag: ${{ github.event.inputs.tag }} # Draft Release Note release-draft-note: needs: close-issues uses: ./.github/workflows/release-draft.yml with: - tag: tag - prev_tag: prev_tag + tag: ${{ github.event.inputs.tag }} + prev_tag: ${{ github.event.inputs.prev_tag }} # Build docker image and push to docker hub release-docker: needs: release-draft-note uses: ./.github/workflows/release-docker.yml with: - tag: tag + tag: ${{ github.event.inputs.tag }} # Sync changes to develop sync-to-develop: From 45ecf11de5a9789753a9e38a4ac0d8ccc3ebfc9e Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 17 Feb 2022 12:17:09 +0800 Subject: [PATCH 8/9] feat: add version in release-close-issue Signed-off-by: Wing-Kam Wong --- .github/workflows/release-close-issue.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-close-issue.yml b/.github/workflows/release-close-issue.yml index bfa06021e6..b8e3c438a7 100644 --- a/.github/workflows/release-close-issue.yml +++ b/.github/workflows/release-close-issue.yml @@ -7,6 +7,9 @@ on: issue_label: description: "All issues with such label will be closed" required: true + version: + description: "Which version is this issue fixed in" + required: true # Triggered by release-nocodb.yml workflow_call: inputs: @@ -14,13 +17,18 @@ on: description: "All issues with such label will be closed" required: true type: string + version: + description: "Which version is this issue fixed in" + required: true + type: string jobs: close-issues: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: close-resolved-issues - uses: bdougie/close-issues-based-on-label@master + uses: wingkwong/close-issues-based-on-label@master env: LABEL: ${{ github.event.inputs.issue_label || inputs.issue_label }} + VERSION: ${{ github.event.inputs.version || inputs.version }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 46df5e2934d1c88e82483bf761a842a0ee5c88db Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 17 Feb 2022 15:26:56 +0800 Subject: [PATCH 9/9] fix: sync changes from master to develop with ff Signed-off-by: Wing-Kam Wong --- .github/workflows/sync-to-develop.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sync-to-develop.yml b/.github/workflows/sync-to-develop.yml index 74fa9837ec..93407111cf 100644 --- a/.github/workflows/sync-to-develop.yml +++ b/.github/workflows/sync-to-develop.yml @@ -1,4 +1,4 @@ -name: 'Sync changes back to develop branch' +name: 'Sync changes back to develop branch from master' on: # Triggered manually @@ -9,12 +9,15 @@ jobs: close-issues: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - name: Checkout + uses: actions/checkout@v1 - - name: Merge master -> develop - uses: devmasx/merge-branch@master + - name: Merge from master to develop + uses: robotology/gh-action-nightly-merge@v1.3.1 with: - type: now - from_branch: master - target_branch: develop - github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + stable_branch: 'master' + development_branch: 'develop' + allow_ff: true + allow_forks: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file