Browse Source

Merge pull request #1281 from nocodb/refactor/github-action

refactor: release workflows
pull/1292/head
աɨռɢӄաօռɢ 3 years ago committed by GitHub
parent
commit
61c7d5b9cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      .github/workflows/release-close-issue.yml
  2. 12
      .github/workflows/release-docker.yml
  3. 16
      .github/workflows/release-draft.yml
  4. 52
      .github/workflows/release-nocodb.yml
  5. 114
      .github/workflows/release-npm.yml
  6. 23
      .github/workflows/sync-to-develop.yml

34
.github/workflows/release-close-issue.yml

@ -0,0 +1,34 @@
name: 'Close Issues with Labels'
on:
# Triggered manually
workflow_dispatch:
inputs:
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:
issue_label:
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: 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 }}

12
.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

16
.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 }} "

52
.github/workflows/release-nocodb.yml

@ -0,0 +1,52 @@
name: 'NocoDB Release'
on:
# Triggered manually
workflow_dispatch:
inputs:
tag:
description: "Target Tag"
required: true
prev_tag:
description: "Previous Tag"
required: true
jobs:
# Close all issues with target tags 'Fixed' & 'Resolved'
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: ${{ github.event.inputs.tag }}
# Draft Release Note
release-draft-note:
needs: close-issues
uses: ./.github/workflows/release-draft.yml
with:
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: ${{ github.event.inputs.tag }}
# Sync changes to develop
sync-to-develop:
needs: release-docker
uses: ./.github/workflows/sync-to-develop.yml

114
.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
@ -44,113 +48,17 @@ jobs:
# committer: GitHub <noreply@github.com>
# 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}}'
title: 'Release ${{ github.event.inputs.tag || inputs.tag }}'
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 }}"
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 }}"

23
.github/workflows/sync-to-develop.yml

@ -0,0 +1,23 @@
name: 'Sync changes back to develop branch from master'
on:
# Triggered manually
workflow_dispatch:
# Triggered by release-nocodb.yml
workflow_call:
jobs:
close-issues:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Merge from master to develop
uses: robotology/gh-action-nightly-merge@v1.3.1
with:
stable_branch: 'master'
development_branch: 'develop'
allow_ff: true
allow_forks: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading…
Cancel
Save