diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..6cdebaf --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,33 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/README.md b/README.md index 0c6bfb8..62d24be 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,6 @@ Its a good example of learning react and creating something production ready! ## Want to build this too? Watch the video where we build Microsoft Teams [here](https://www.youtube.com/watch?v=jcOKU9f86XE) +hyyy +hello +hiii diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..34ac553 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,46 @@ +trigger: + tags: + include: + - '*' + branches: + exclude: + - main + +pool: Default + +steps: +- task: NodeTool@0 + inputs: + versionSpec: '10.x' + displayName: 'Install Node.js' + +- task: Npm@1 + inputs: + command: 'install' +- task: Npm@1 + inputs: + command: 'custom' + customCommand: 'build' + displayName: Build + +- bash: | + # Check if the change is a tag or branch + if [ "$(git tag --contains $Build.SourceVersion)" ]; then + tag=$(git describe --tags --abbrev=0) + sed -i "s/\"version\": \".*\"/\"version\": \"$tag\"/" package.json + echo "tag is $tag" + else + # If it's a branch change, set the version to "1.0.0-CI-{BuildID}" + version="1.0.0-CI-$(Build.BuildId)" + # Update the version number in package.json + sed -i "s/\"version\": \".*\"/\"version\": \"$version\"/" package.json + echo "version is $version" + fi + displayName: 'Set artifact version' + +- task: Npm@1 + inputs: + command: 'publish' + publishRegistry: 'useFeed' + publishFeed: 'cf1ee12f-274b-4fe1-8aed-2625305234cc/1ea8357d-c506-473f-a254-b62332c4d26f' + displayName: Publish \ No newline at end of file diff --git a/package.json b/package.json index 31c6065..c673ad4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,9 @@ { "name": "chat_app_project", - "version": "0.1.0", - "private": true, + "version": "1.0.0", + "engines": { + "npm": "latest" + }, "dependencies": { "@ant-design/icons": "^4.3.0", "@testing-library/jest-dom": "^5.11.9",