diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b89ab4e..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,77 +0,0 @@ -# Javascript Node CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-javascript/ for more details -# - -version: 2 - -defaults: &defaults - working_directory: ~/repo - docker: - - image: circleci/node:10.15.0 - -jobs: - test: - <<: *defaults - steps: - - checkout - - - restore_cache: - keys: - - v1-dependencies- - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - - run: npm install --no-package-lock - - - run: - name: Run tests - command: npm test - - - run: - name: Run build - command: npm run build - - - save_cache: - paths: - - node_modules - key: v1-dependencies- - - - persist_to_workspace: - root: ~/repo - paths: - - dist - - package* - - node_modules - - LICENSE.txt - - README.md - - deploy: - <<: *defaults - steps: - - attach_workspace: - at: ~/repo - - run: - name: Authenticate with registry - command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc - - run: - name: Publish package - command: npm publish - -workflows: - version: 2 - test-deploy: - jobs: - - test: - filters: - tags: - only: /^v.*/ - - - deploy: - requires: - - test - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..94acfdb --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,39 @@ +name: Build and Test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [24.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Cache Node.js modules + uses: actions/cache@v3 + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node- + ${{ runner.OS }}- + - run: npm install + - run: npm run build --if-present + - run: npm run lint + - run: npm test + env: + CI: true + # - name: Publish to npm + # uses: pascalgn/npm-publish-action@1.2.0 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..7d7abd8 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,63 @@ +name: Release + +on: + #push: + # branches: + # - main + + # Only run if the general build for the main branch has completed + workflow_run: + workflows: ["Build and Test"] + branches: [main] + types: + - completed + +jobs: + release: + name: Release + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.test }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 24 + - name: Install dependencies + run: npm ci + - name: Install semantic-release extra plugins + run: npm install --save-dev @semantic-release/changelog @semantic-release/git + # - name: Lint + # run: npm run lint-fix + # - name: Test + # run: npm run test:unit --if-present + - name: Build + run: npm run build + - name: Release + id: release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + run: | + npx semantic-release + echo "version=$(npx semantic-release --version)" >> $GITHUB_OUTPUT + - name: GitHub Release update + uses: softprops/action-gh-release@v1 + #if: startsWith(github.ref, 'refs/tags/') + with: + # body_path: ${{ github.workspace }}-CHANGELOG.txt + # note you'll typically need to create a personal access token + # with permissions to create releases in the other repoj + #token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} + tag_name: ${{ steps.release.outputs.version }} + files: | + LICENSE.md + README.md + lib + package.json