name: "Release : NPM packages" 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@v3 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@v3 with: node-version: 16.15.0 registry-url: 'https://registry.npmjs.org' - run: | export NODE_OPTIONS="--max_old_space_size=16384" 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/upgradeNocodbSdk.js && targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js && cd packages/nc-gui && 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/upgradeNcGui.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@v4.2.3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: 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.15.5" env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" PULL_REQUEST: "${{ steps.cpr.outputs.pull-request-number }}" MERGE_LABELS: "Bot: Automerge"