diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..c4526a5 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,51 @@ +name-template: "v$RESOLVED_VERSION 🌈" +tag-template: "v$RESOLVED_VERSION" +exclude-labels: + - "release" + - "auto" +autolabeler: + - label: "docs" + files: + - "*.md" + branch: + - '/docs{0,1}\/.+/' + - label: "bug" + branch: + - '/fix\/.+/' + title: + - "/fix/i" + - label: "enhancement" + branch: + - '/feature\/.+/' +categories: + - title: "🚀 Features" + labels: + - "feature" + - "enhancement" + - title: "🐛 Bug Fixes" + labels: + - "fix" + - "bugfix" + - "bug" + - title: "📖 Docs" + labels: + - "docs" + - title: "🧰 Maintenance" + label: "chore" +change-template: "- $TITLE @$AUTHOR (#$NUMBER)" +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - "major" + minor: + labels: + - "minor" + patch: + labels: + - "patch" + default: patch +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..c093b90 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + branches: + - main + tags: + - "release" + +jobs: + npm: + name: Publish package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: "14" + registry-url: "https://registry.npmjs.org/" + - name: Prepare + run: | + yarn --frozen-lockfile + yarn build + - name: Set released version to env + run: node -p -e '`RELEASED_PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV + - name: Create release draft on GitHub + uses: release-drafter/release-drafter@v5 + with: + version: ${{ env.RELEASED_PACKAGE_VERSION }} + name: ${{ env.RELEASED_PACKAGE_VERSION }} + tag: ${{ env.RELEASED_PACKAGE_VERSION }} + publish: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..fd6d9b6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +name: test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: "yarn" + - run: yarn --frozen-lockfile + - run: yarn run build + - run: yarn run test diff --git a/package.json b/package.json index 4597461..5222780 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,7 @@ "scripts": { "test": "jest", "build": "tsc", - "lint": "eslint --fix 'src/**/*.ts'", - "prepublishOnly": "yarn build" + "lint": "eslint --fix 'src/**/*.ts'" }, "jest": { "moduleFileExtensions": [