diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..c6af71dc --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,74 @@ +version: 2.1 +orbs: + node: circleci/node@7.0.0 +executors: + node22: + docker: + - image: cimg/node:22.13 +jobs: + lint_test_build: + executor: + name: node22 + steps: + - checkout + - restore_cache: + keys: + - v1-dependencies-{{ checksum "yarn.lock" }} + - v1-dependencies- + - node/install-yarn + - run: yarn install --frozen-lockfile + - save_cache: + paths: + - ./node_modules + key: v1-dependencies-{{ checksum "yarn.lock" }} + - run: yarn run lint + - run: yarn run coverage + - run: yarn run build + - run: yarn pack + - persist_to_workspace: + root: /home/circleci/project + paths: + - ./aion-dk-js-client-*.tgz + publish: + executor: + name: node22 + steps: + - attach_workspace: + at: /tmp/workspace + - run: + name: Move files + command: | + mv /tmp/workspace/aion-dk-js-client-*.tgz ./ + - run: + name: Set npm access token + command: | + npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN + - run: + name: Publish to NPM + command: | + package_file=$(ls aion-dk-js-client-*.tgz) + if echo "${package_file}" | grep -E "alpha|beta" > /dev/null; then + prerelease=$(echo "${package_file}" | grep -E -o "alpha|beta") + echo "Publishing prerelease with tag ${prerelease} to NPM" + npm publish ${package_file} --tag ${prerelease} + else + echo "Publishing release with to NPM" + npm publish ${package_file} + fi +workflows: + build_and_deploy: + jobs: + - lint_test_build: + filters: + branches: + only: /.*/ + tags: + only: /^v.*/ + - publish: + requires: + - lint_test_build + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml deleted file mode 100644 index 710a6827..00000000 --- a/.github/workflows/package.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Package -on: - release: - types: [created, published] -jobs: - publish-package: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: '22.13.0' - cache: 'yarn' - registry-url: 'https://registry.npmjs.org' - - run: yarn install --frozen-lockfile - - run: yarn build - - run: yarn publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index ca660ba3..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Tests -on: [push] -jobs: - tests: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: '22.13.0' - cache: 'yarn' - - name: Install packages - run: yarn - - name: Run linter - run: yarn lint - - name: Run tests with coverage report - run: yarn coverage - - name: Private actions checkout - uses: daspn/private-actions-checkout@v2 - with: - actions_list: '["aion-dk/build-and-push-action@v1.0.6"]' - checkout_base_path: ./.github/actions - ssh_private_key: ${{ secrets.PUBLIC_PROJECT_PRIVATE_REPO_ACCESS_KEY }} - - - name: "Build and push docker image" - uses: ./.github/actions/build-and-push-action - with: - image_name: js-client - ecr_access_key_id: ${{ secrets.AWS_RW_ACCESS_KEY_ID }} - ecr_secret_key: ${{ secrets.AWS_RW_SECRET_KEY }} diff --git a/.npmrc b/.npmrc deleted file mode 100644 index b6f27f13..00000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -engine-strict=true