diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c4940cf..99d8f40 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -10,6 +10,37 @@ This project adheres to the Adobe [code of conduct](../CODE_OF_CONDUCT.md). By p you are expected to uphold this code. Please report unacceptable behavior to [Grp-opensourceoffice@adobe.com](mailto:Grp-opensourceoffice@adobe.com). +## Release +- based on Angular Commit Message Conventions in commits - + https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit-message-header +- Commit message format is used to build: + * Release notes + * Changelog updates + * NPM package semver + +## Commit message Convention + +``` +(): +│ │ │ +│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end. +│ │ +│ └─⫸ Commit Scope (optional): project|based|list +│ +└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test +``` + + +### Major Version Release: + +In order to trigger Major Version upgrade, `BREAKING CHANGE:` needs to be in the footer of a commit message: + +``` +(): + +BREAKING CHANGE: +``` + ## Have A Question? Start by filing an issue. The existing committers on this project work to reach diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..66a86b3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI + +on: + push: + branches: [ '**' ] + pull_request: + branches: [ $default-branch ] + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node-version: [20.x] + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: npm ci + - name: Build Library + run: npm run build --if-present + - name: Run Tests + run: npm test --if-present diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml new file mode 100644 index 0000000..52cc34a --- /dev/null +++ b/.github/workflows/manual-release.yml @@ -0,0 +1,75 @@ +name: Manual Release +on: + workflow_dispatch: + inputs: + version: + description: 'Version' + type: choice + required: true + default: fix + options: + - fix + - feat + - BREAKING CHANGE + dryRun: + description: 'DryRun' + type: boolean + default: true +# ENV and Config +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} + GIT_AUTHOR_NAME: github-actions + GIT_AUTHOR_EMAIL: github-actions@github.com + GIT_COMMITTER_NAME: github-actions + GIT_COMMITTER_EMAIL: github-actions@github.com + CI: true + CONFIG_NODE_VERSION: '["20.x"]' + CONFIG_OS: '["ubuntu-latest"]' +# Main Job +jobs: + config: + runs-on: ubuntu-latest + outputs: + NODE_VERSION: ${{ steps.set-config.outputs.CONFIG_NODE_VERSION }} + OS: ${{ steps.set-config.outputs.CONFIG_OS }} + steps: + - id: set-config + run: | + echo "CONFIG_NODE_VERSION=${{ toJSON(env.CONFIG_NODE_VERSION) }}" >> $GITHUB_OUTPUT + echo "CONFIG_OS=${{ toJSON(env.CONFIG_OS) }}" >> $GITHUB_OUTPUT + release: + name: Test, Build and force Release + needs: config + + runs-on: ${{ matrix.OS }} + strategy: + matrix: + OS: ${{ fromJSON(needs.config.outputs.OS) }} + NODE_VERSION: ${{ fromJSON(needs.config.outputs.NODE_VERSION) }} + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Setup Node.js ${{ matrix.NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.NODE_VERSION }} + - name: Commit trigger + run: | + git commit --allow-empty -m "${{ github.event.inputs.version }}: Trigger Manual Release + + ${{ github.event.inputs.version }}:Forced Manual Release without code changes" + - name: Install dependencies + run: npm ci + - name: Build Library + run: npm run build --if-present + - name: Run Tests + run: npm test --if-present + - name: Publish npm package + uses: cycjimmy/semantic-release-action@v4 + with: + dry_run: ${{ github.event.inputs.dryRun == 'true' }} + extra_plugins: | + @semantic-release/changelog + @semantic-release/git diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml deleted file mode 100644 index 9eaf510..0000000 --- a/.github/workflows/nodejs.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Node.js CI - -on: - push: - branches: [ '**' ] - pull_request: - branches: [ main ] - -jobs: - build: - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - node-version: [20.x] - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - run: npm i - - run: npm run build --if-present - - run: npm test diff --git a/.github/workflows/on-push-publish-to-npm.yml b/.github/workflows/on-push-publish-to-npm.yml deleted file mode 100644 index 30064ba..0000000 --- a/.github/workflows/on-push-publish-to-npm.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: on-push-publish-to-npm -on: - push: - branches: - - main - paths: - - 'package.json' -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: npm ci - - run: npm test - - uses: JS-DevTools/npm-publish@v3 - with: - token: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..63dbe6c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + release: + name: Test, Build and Release + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest ] + node-version: [ 20.x ] + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix['node-version'] }} + - name: Install dependencies + run: npm ci + - name: Build Library + run: npm run build --if-present + - name: Run Tests + run: npm test --if-present + - name: Release + uses: cycjimmy/semantic-release-action@v4 + with: + dry_run: true + extra_plugins: | + @semantic-release/changelog + @semantic-release/git + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} + GIT_AUTHOR_NAME: github-actions + GIT_AUTHOR_EMAIL: github-actions@github.com + GIT_COMMITTER_NAME: github-actions + GIT_COMMITTER_EMAIL: github-actions@github.com + CI: true diff --git a/.github/workflows/version-bump-publish.yml b/.github/workflows/version-bump-publish.yml deleted file mode 100644 index aec827c..0000000 --- a/.github/workflows/version-bump-publish.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: version-bump-publish -on: - workflow_dispatch: - inputs: - level: - description: ' | major | minor | patch | premajor | preminor | prepatch | prerelease' - required: true - default: 'patch' - tag: - description: 'The tag to publish to.' - required: false - default: 'latest' - dryRun: - description: 'Test with --dry-run' - type: boolean - default: true - -jobs: - checkout: - name: checkout - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: | - git config user.name github-actions - git config user.email github-actions@github.com - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: | - npm ci - npm test - - name: bump and pub - if: ${{ github.event.inputs.level != '' }} - run: | - npm version ${{ github.event.inputs.level }} - git push - - uses: JS-DevTools/npm-publish@v3 - with: - token: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} - dry-run: ${{ github.event.inputs.dryRun }} - tag: ${{ github.event.inputs.tag }} diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..7c78d4c --- /dev/null +++ b/.releaserc @@ -0,0 +1,20 @@ +{ + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/changelog", + { + "changelogFile": "docs/CHANGELOG.md" + } + ], + "@semantic-release/npm", + [ + "@semantic-release/git", + { + "assets": ["docs/CHANGELOG.md", "package.json"] + } + ] + ] +} \ No newline at end of file diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md new file mode 100644 index 0000000..e69de29