From 21cdefaddef2558c1654e75cc3df77110fac51ae Mon Sep 17 00:00:00 2001 From: Sander Declerck Date: Fri, 11 Jul 2025 17:20:39 +0200 Subject: [PATCH] Add editorconfig + github workflows --- .editorconfig | 8 +++++ .github/workflows/build-and-release.yml | 41 +++++++++++++++++++++++++ .github/workflows/test-on-pr.yml | 28 +++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/workflows/build-and-release.yml create mode 100644 .github/workflows/test-on-pr.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..afcf1bc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ + +[*] +charset = utf-8 +insert_final_newline = true +end_of_line = lf +indent_style = space +indent_size = 2 +max_line_length = 80 diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..455ccd6 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,41 @@ +name: Create Release + +on: + push: + tags: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "lts/*" + registry-url: "https://registry.npmjs.org/" + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} + + - name: Set version number + id: get_version + run: | + version="${{ github.ref_name }}" + echo "tag=$version" >> $GITHUB_OUTPUT + + - name: Set the version + run: npm --no-git-tag-version version ${{ steps.get_version.outputs.tag }} + + - name: Install dependencies + run: npm ci + + - name: Publish to npm + run: | + echo "Publishing version ${{ steps.get_version.outputs.tag }} to NPM" + npm publish --access public + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} diff --git a/.github/workflows/test-on-pr.yml b/.github/workflows/test-on-pr.yml new file mode 100644 index 0000000..b726376 --- /dev/null +++ b/.github/workflows/test-on-pr.yml @@ -0,0 +1,28 @@ +name: Run Unit Tests + +on: + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "lts/*" + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + - name: Run ESLint + run: npm run lint