From e49bcaefa0fd567f46425294d6ed2f4ae41fcd4a Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 10 Oct 2024 12:17:25 +0530 Subject: [PATCH] ci: add release and labels workflows --- .github/workflows/checks.yml | 1 + .github/workflows/labels.yml | 15 +++++++ .github/workflows/release.yml | 32 ++++++++++++++ eslint.config.js | 2 + package.json | 81 ++++++++++++++++++++--------------- 5 files changed, 96 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/labels.yml create mode 100644 .github/workflows/release.yml create mode 100644 eslint.config.js diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 885732a1..96ffdbe7 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -2,6 +2,7 @@ name: test on: - push - pull_request + - workflow_call jobs: lint: diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml new file mode 100644 index 00000000..af9b6f06 --- /dev/null +++ b/.github/workflows/labels.yml @@ -0,0 +1,15 @@ +name: Sync labels +on: + workflow_dispatch: +permissions: + issues: write +jobs: + labels: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: EndBug/label-sync@v2 + with: + config-file: 'https://raw.githubusercontent.com/thetutlage/static/main/labels.yml' + delete-other-labels: true + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..fde89b42 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: release +on: workflow_dispatch +permissions: + contents: write + id-token: write +jobs: + checks: + uses: ./.github/workflows/checks.yml + release: + needs: checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: git config + run: | + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + - name: Init npm config + run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: npm install + - run: npm run release -- --ci + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..e4cad4b9 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,2 @@ +import { configPkg } from '@adonisjs/eslint-config' +export default configPkg() diff --git a/package.json b/package.json index c93f2f6d..ea91318d 100644 --- a/package.json +++ b/package.json @@ -52,59 +52,55 @@ "release": "np", "version": "npm run build", "typecheck": "tsc --noEmit", - "sync-labels": "github-label-sync --labels ./node_modules/@adonisjs/mrm-preset/gh-labels.json adonisjs/lucid", "format": "prettier --write .", "prepublishOnly": "npm run build", "test": "c8 npm run test:docker", "index:commands": "adonis-kit index build/commands" }, "devDependencies": { - "@adonisjs/assembler": "^7.7.0", - "@adonisjs/core": "^6.12.1", - "@adonisjs/eslint-config": "^1.3.0", - "@adonisjs/prettier-config": "^1.3.0", - "@adonisjs/tsconfig": "^1.3.0", - "@commitlint/cli": "^19.4.0", - "@commitlint/config-conventional": "^19.2.2", + "@adonisjs/assembler": "^7.8.2", + "@adonisjs/core": "^6.14.1", + "@adonisjs/eslint-config": "^2.0.0-beta.7", + "@adonisjs/prettier-config": "^1.4.0", + "@adonisjs/tsconfig": "^1.4.0", "@japa/assert": "^3.0.0", "@japa/file-system": "^2.3.0", "@japa/runner": "^3.1.4", "@libsql/sqlite3": "^0.3.1", - "@swc/core": "^1.7.6", + "@release-it/conventional-changelog": "^8.0.2", + "@swc/core": "^1.7.26", "@types/chance": "^1.1.6", "@types/luxon": "^3.4.2", - "@types/node": "^22.1.0", + "@types/node": "^22.7.5", "@types/pretty-hrtime": "^1.0.3", - "@types/qs": "^6.9.15", + "@types/qs": "^6.9.16", "@vinejs/vine": "^2.1.0", - "better-sqlite3": "^11.1.2", + "better-sqlite3": "^11.3.0", "c8": "^10.1.2", "chance": "^1.1.12", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", - "del-cli": "^5.1.0", + "del-cli": "^6.0.0", "dotenv": "^16.4.5", - "eslint": "^8.57.0", + "eslint": "^9.12.0", "fs-extra": "^11.2.0", - "github-label-sync": "^2.3.1", - "husky": "^9.1.4", "luxon": "^3.5.0", - "mysql2": "^3.11.0", - "np": "^10.0.7", - "pg": "^8.12.0", + "mysql2": "^3.11.3", + "pg": "^8.13.0", "prettier": "^3.3.3", "reflect-metadata": "^0.2.2", + "release-it": "^17.8.2", "sqlite3": "^5.1.7", - "tedious": "^18.3.0", + "tedious": "^18.6.1", "ts-node": "^10.9.2", - "typescript": "^5.5.4" + "typescript": "^5.6.3" }, "dependencies": { - "@adonisjs/presets": "^2.6.1", - "@faker-js/faker": "^8.4.1", - "@poppinss/hooks": "^7.2.3", - "@poppinss/macroable": "^1.0.2", - "@poppinss/utils": "^6.7.3", + "@adonisjs/presets": "^2.6.3", + "@faker-js/faker": "^9.0.3", + "@poppinss/hooks": "^7.2.4", + "@poppinss/macroable": "^1.0.3", + "@poppinss/utils": "^6.8.3", "fast-deep-equal": "^3.1.3", "igniculus": "^1.5.0", "kleur": "^4.1.5", @@ -141,9 +137,6 @@ "overrides": { "strtok3": "8.0.1" }, - "eslintConfig": { - "extends": "@adonisjs/eslint-config/package" - }, "prettier": "@adonisjs/prettier-config", "commitlint": { "extends": [ @@ -152,13 +145,31 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "provenance": true }, - "np": { - "message": "chore(release): %s", - "tag": "latest", - "branch": "main", - "anyBranch": false + "release-it": { + "git": { + "requireCleanWorkingDir": true, + "requireUpstream": true, + "commitMessage": "chore(release): ${version}", + "tagAnnotation": "v${version}", + "push": true, + "tagName": "v${version}" + }, + "github": { + "release": true + }, + "npm": { + "publish": true, + "skipChecks": true + }, + "plugins": { + "@release-it/conventional-changelog": { + "preset": { + "name": "angular" + } + } + } }, "c8": { "reporter": [