diff --git a/.commitlintrc.js b/.commitlintrc.js new file mode 100644 index 0000000..4b75989 --- /dev/null +++ b/.commitlintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ['@commitlint/config-conventional'] + }; \ No newline at end of file diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..70066cc --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,13 @@ +name: Lint Commit Messages +on: [pull_request, push] + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: wagoid/commitlint-github-action@v5 + with: + configFile: .commitlintrc.js \ No newline at end of file diff --git a/.github/workflows/notify-discord.yml b/.github/workflows/notify-discord.yml new file mode 100644 index 0000000..76cec79 --- /dev/null +++ b/.github/workflows/notify-discord.yml @@ -0,0 +1,16 @@ +name: Discord notification + +on: + release: + types: [published] + +jobs: + discord-notification: + runs-on: ubuntu-latest + steps: + - name: Discord notification 📯 + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@0.3.2 + with: + args: '${{ github.event.repository.name }} [${{ github.event.release.tag_name }}](${{ github.event.release.html_url }}) has been released. 🚀' \ No newline at end of file diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml new file mode 100644 index 0000000..4fd842c --- /dev/null +++ b/.github/workflows/on-pull-request.yml @@ -0,0 +1,48 @@ +name: Test Pull Request + +on: pull_request + +jobs: + build: + strategy: + matrix: + node-version: [18.x, 20.x] + os: [ubuntu-latest, windows-latest] + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - 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@v4 + with: + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node- + ${{ runner.OS }}- + + - name: Install dependencies ⏬ + run: npm install + + - name: Lint code 💄 + run: npm run lint + + - name: Test code ✅ + run: npm run test + + - name: Build artifacts 🏗️ + run: npm run build + + - name: Publish to coveralls ⭐ + # coverage/lcov.info was generated in the previous npm run build step + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/on-push-main.yml b/.github/workflows/on-push-main.yml new file mode 100644 index 0000000..9dff4aa --- /dev/null +++ b/.github/workflows/on-push-main.yml @@ -0,0 +1,50 @@ +name: Test Push to Main + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x] + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Cache Node.js modules 💾 + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node- + ${{ runner.OS }}- + + - name: Install dependencies ⏬ + run: npm install + + - name: Lint code 💄 + run: npm run lint + + - name: Test code ✅ + run: npm run test + + - name: Build artifacts 🏗️ + run: npm run build + + - name: Publish to coveralls ⭐ + # coverage/lcov.info was generated in the previous npm run build step + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a8dc3d3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release + +on: + workflow_dispatch: + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout sources 🔰 + uses: actions/checkout@v4 + + - name: Setup Node.js 20 👷🏻 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Prepare git config + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Install dependencies ⏬ + run: npm ci + + - name: Build artifacts 🏗️ + run: npm run build + + - name: Release 🚀 + uses: cycjimmy/semantic-release-action@v4.1.0 + id: semantic + env: + GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..a5cfb0c --- /dev/null +++ b/.releaserc @@ -0,0 +1,37 @@ +{ + "branches": [ + "main", + { + "name": "next", + "prerelease": true + }], + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits" + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits", + "presetConfig": { + "header": "Changelog of GeoStyler Parser for ArcGIS Pro layer files." + } + } + ], + "@semantic-release/changelog", + "@semantic-release/npm", + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", "package.json", "package-lock.json" + ], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ], + "@semantic-release/github" + ] +} \ No newline at end of file