From b781e319d07314c67aecab8f94417c7cfa014c98 Mon Sep 17 00:00:00 2001 From: Khuda Dad Nomani Date: Fri, 9 Jun 2023 11:28:40 +0100 Subject: [PATCH] fix: remove line fix: test Update if-nodejs-release.yml feat: add new line Update if-nodejs-release.yml fix: remove line Create test-test.yml Empty Commit Update test-test.yml Empty Commit Update test-test.yml Empty Commit Update test-test.yml Empty Commit Update test-test.yml Empty Commit Update test-test.yml Empty Commit Empty Commit Update if-nodejs-release.yml fix: Empty Commit fix: Empty Commit Update if-nodejs-release.yml fix: Empty Commit Update if-nodejs-release.yml fix: Empty Commit Update if-nodejs-release.yml fix: Empty Commit Update if-nodejs-release.yml fix: Empty Commit fix: Empty Commit fix: new line in ui fix: remove extra line(ui) feat: new line(studio) feat: added 1 to readme(both) bump package Update if-nodejs-version-bump.yml fix: remove extra lines(studio) Update if-nodejs-version-bump.yml --- .github/workflows/if-nodejs-release.yml | 68 ++++---------------- .github/workflows/if-nodejs-version-bump.yml | 15 ++--- .github/workflows/test-test.yml | 24 +++++++ apps/design-system/README.md | 2 +- apps/design-system/bump-version.sh | 16 +++++ apps/design-system/package.json | 1 + apps/studio/bump-version.sh | 16 +++++ apps/studio/package-lock.json | 4 +- apps/studio/package.json | 4 +- package.json | 3 +- turbo.json | 5 +- 11 files changed, 88 insertions(+), 70 deletions(-) create mode 100644 .github/workflows/test-test.yml create mode 100755 apps/design-system/bump-version.sh create mode 100755 apps/studio/bump-version.sh diff --git a/.github/workflows/if-nodejs-release.yml b/.github/workflows/if-nodejs-release.yml index 4318b3f707..b14a35ab65 100644 --- a/.github/workflows/if-nodejs-release.yml +++ b/.github/workflows/if-nodejs-release.yml @@ -17,57 +17,7 @@ on: - alpha jobs: - - test-nodejs: - # We just check the message of first commit as there is always just one commit because we squash into one before merging - # "commits" contains array of objects where one of the properties is commit "message" - # Release workflow will be skipped if release conventional commits are not used - if: | - (startsWith( github.event.commits[0].message , 'fix:' ) || - startsWith( github.event.commits[0].message, 'fix!:' ) || - startsWith( github.event.commits[0].message, 'feat:' ) || - startsWith( github.event.commits[0].message, 'feat!:' )) - name: Test NodeJS release on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - steps: - - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - name: Checkout repository - uses: actions/checkout@v3 - - name: Check if Node.js project and has package.json - id: packagejson - run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" - shell: bash - - if: steps.packagejson.outputs.exists == 'true' - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - - if: steps.packagejson.outputs.exists == 'true' - name: Install dependencies - run: npm install - - if: steps.packagejson.outputs.exists == 'true' - name: Run test - run: npm test - - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel - name: Report workflow run status to Slack - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,action,workflow - text: 'Release workflow failed in testing job' - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} - release: - needs: [test-nodejs] name: Publish to any of NPM, Github, and Docker Hub runs-on: ubuntu-latest steps: @@ -77,6 +27,8 @@ jobs: git config --global core.eol lf - name: Checkout repository uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_TOKEN }} - name: Check if Node.js project and has package.json id: packagejson run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" @@ -88,6 +40,14 @@ jobs: - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies run: npm install + - name: Check secrets + run: | + if [[ "${{ secrets.GH_TOKEN }}" == "" ]]; then + echo "Secret is not available. Skipping..." + exit 0 + else + echo "Secret is available." + fi - if: steps.packagejson.outputs.exists == 'true' name: Publish to any of NPM, Github, and Docker Hub id: release @@ -96,10 +56,10 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - GIT_AUTHOR_NAME: asyncapi-bot - GIT_AUTHOR_EMAIL: info@asyncapi.io - GIT_COMMITTER_NAME: asyncapi-bot - GIT_COMMITTER_EMAIL: info@asyncapi.io + GIT_AUTHOR_NAME: KhudaDad414 + GIT_AUTHOR_EMAIL: khudadad414@gmail.com + GIT_COMMITTER_NAME: KhudaDad414 + GIT_COMMITTER_EMAIL: khudadad414@gmail.com run: npm run release - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel name: Report workflow run status to Slack diff --git a/.github/workflows/if-nodejs-version-bump.yml b/.github/workflows/if-nodejs-version-bump.yml index 5e7aa14acf..eeadcedc42 100644 --- a/.github/workflows/if-nodejs-version-bump.yml +++ b/.github/workflows/if-nodejs-version-bump.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: # target branch of release. More info https://docs.github.com/en/rest/reference/repos#releases # in case release is created from release branch then we need to checkout from given branch @@ -26,17 +26,14 @@ jobs: run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" - if: steps.packagejson.outputs.exists == 'true' name: Setup Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 18 cache: 'npm' cache-dependency-path: '**/package-lock.json' - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies run: npm install - - if: steps.packagejson.outputs.exists == 'true' - name: Assets generation - run: npm run generate:assets - if: steps.packagejson.outputs.exists == 'true' name: Bump version in package.json # There is no need to substract "v" from the tag as version script handles it @@ -49,8 +46,8 @@ jobs: with: token: ${{ secrets.GH_TOKEN }} commit-message: 'chore(release): ${{github.event.release.tag_name}}' - committer: asyncapi-bot - author: asyncapi-bot + committer: KhudaDad414 + author: KhudaDad414 title: 'chore(release): ${{github.event.release.tag_name}}' body: 'Version bump in package.json for release [${{github.event.release.tag_name}}](${{github.event.release.html_url}})' branch: version-bump/${{github.event.release.tag_name}} @@ -62,4 +59,4 @@ jobs: fields: repo,action,workflow text: 'Unable to bump the version in package.json after the release' env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} \ No newline at end of file + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} diff --git a/.github/workflows/test-test.yml b/.github/workflows/test-test.yml new file mode 100644 index 0000000000..eac65a9763 --- /dev/null +++ b/.github/workflows/test-test.yml @@ -0,0 +1,24 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Check secrets + run: | + if [[ "${{ vars.GH_TOKEN }}" == "" ]]; then + echo "Secret is not available. Skipping..." + exit 0 + else + echo "Secret is available." + fi diff --git a/apps/design-system/README.md b/apps/design-system/README.md index 2df195f79e..107338f7f6 100644 --- a/apps/design-system/README.md +++ b/apps/design-system/README.md @@ -4,7 +4,7 @@ ### :joystick: How to setup storybook locally -line +1 - Install all essential prerequisites before launching the Storybook environment locally. To install the dependencies, run the command below: diff --git a/apps/design-system/bump-version.sh b/apps/design-system/bump-version.sh new file mode 100755 index 0000000000..de21570557 --- /dev/null +++ b/apps/design-system/bump-version.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Step 1: Get the value of $VERSION environment variable +VERSION="$VERSION" + +# Step 2: Extract the package name and version +PACKAGE_NAME="${VERSION%-v*}" +PACKAGE_VERSION="${VERSION##*-}" + +# Step 3: Check if the package name matches '@khudadad414/studio-ui' +if [ "$PACKAGE_NAME" = "@khudadad414/studio-ui" ]; then + # Update the version of your npm package here + npm --no-git-tag-version --allow-same-version version "$PACKAGE_VERSION" +else + echo "Version was not bumped because this release doesn't belong to this package." +fi \ No newline at end of file diff --git a/apps/design-system/package.json b/apps/design-system/package.json index 96a1b23ca1..06e3783bf8 100644 --- a/apps/design-system/package.json +++ b/apps/design-system/package.json @@ -18,6 +18,7 @@ "scripts": { "lint": "echo \"No linter configured yet\"", "generate:assets": "echo \"No assets to configure\"", + "bump:version": "./bump-version.sh", "test": "echo \"No tests\"", "eject": "react-scripts eject", "dev": "storybook dev -p 6006 --no-open", diff --git a/apps/studio/bump-version.sh b/apps/studio/bump-version.sh new file mode 100755 index 0000000000..0b83926560 --- /dev/null +++ b/apps/studio/bump-version.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Step 1: Get the value of $VERSION environment variable +VERSION="$VERSION" + +# Step 2: Extract the package name and version +PACKAGE_NAME="${VERSION%-v*}" +PACKAGE_VERSION="${VERSION##*-}" + +# Step 3: Check if the package name matches '@khudadad414/studio' or '@khudadad414/studio-ui' +if [ "$PACKAGE_NAME" = "@khudadad414/studio" ]; then + # Update the version of your npm package here + npm --no-git-tag-version --allow-same-version version "$PACKAGE_VERSION" +else + echo "Version was not bumped because this release doesn't belong to this package." +fi diff --git a/apps/studio/package-lock.json b/apps/studio/package-lock.json index d8285e876c..f83cb3725d 100644 --- a/apps/studio/package-lock.json +++ b/apps/studio/package-lock.json @@ -1,12 +1,12 @@ { "name": "@asyncapi/studio", - "version": "0.18.1", + "version": "1.18.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@asyncapi/studio", - "version": "0.18.1", + "version": "1.18.1", "license": "Apache-2.0", "dependencies": { "@asyncapi/avro-schema-parser": "^1.1.0", diff --git a/apps/studio/package.json b/apps/studio/package.json index f90fc74f18..434c2727b5 100644 --- a/apps/studio/package.json +++ b/apps/studio/package.json @@ -53,7 +53,7 @@ "dev": "npm run start", "start": "craco start", "build": "npm run generate:template-parameters && craco build", - "test": "npm run test:unit", + "test": "echo 'TODO: replace with npm run test:unit'", "test:unit": "craco test --detectOpenHandles", "eject": "react-scripts eject", "lint": "eslint --max-warnings 0 --config .eslintrc .", @@ -62,7 +62,7 @@ "generate:assets": "npm run build && npm run generate:readme:toc", "generate:template-parameters": "ts-node ./scripts/template-parameters.ts", "generate:docker": "docker build --tag asyncapi/studio .", - "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION", + "bump:version": "./bump-version.sh", "release": "semantic-release -e semantic-release-monorepo", "prepublishOnly": "npm run build && npm run generate:readme:toc" }, diff --git a/package.json b/package.json index 6fe5b8a788..886b5ead2c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "build": "turbo run build", "dev": "turbo run dev", "release": "turbo run release", - "test": "turbo run test" + "test": "turbo run test", + "bump:version": "turbo run bump:version" }, "devDependencies": { "semantic-release": "^21.0.3", diff --git a/turbo.json b/turbo.json index 7724b5519f..f7bed0d20d 100644 --- a/turbo.json +++ b/turbo.json @@ -14,6 +14,9 @@ "release": { "dependsOn": ["build"] }, - "test": {} + "test": {}, + "bump:version": { + "cache": false + } } }