Skip to content

Commit

Permalink
feat: add configuration for automated releases (#53)
Browse files Browse the repository at this point in the history
* add configuration for automated releases
* add bundle to release notes
* update README.md
* add missing release npm script
* add missing get-version script
  • Loading branch information
derberg authored Mar 23, 2020
1 parent 563274d commit 617bd02
Show file tree
Hide file tree
Showing 12 changed files with 6,600 additions and 143 deletions.
15 changes: 15 additions & 0 deletions .github/pull-request-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Thank you for your contribution. Before you submit the pull request:
1. Follow contributing guidelines and make sure PR title follows Conventional Commits specification -> https://github.com/asyncapi/generator/blob/master/CONTRIBUTING.md
2. Test your changes and attach their results to the pull request.
3. Update the relevant documentation.
-->

**Description**

- ...
- ...
- ...

**Related issue(s)**
<!-- If you refer to a particular issue, provide its number, othewise, remove this section.
For example, `Resolves #123`, `Fixes #43`, or `See also #33`. The 3rd option will not close the issue automatically after the merge. -->
47 changes: 47 additions & 0 deletions .github/workflows/automerge-release-pr-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Automerge release bump PR

on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
pull_request_review:
types:
- submitted
check_suite:
types:
- completed
status: {}

jobs:

autoapprove:
runs-on: ubuntu-latest
steps:
- name: Autoapproving
uses: hmarr/[email protected]
if: github.actor == 'asyncapi-bot'
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

automerge:
needs: [autoapprove]
runs-on: ubuntu-latest
steps:
- name: Automerging
uses: pascalgn/[email protected]
if: github.actor == 'asyncapi-bot'
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
GITHUB_LOGIN: asyncapi-bot
MERGE_LABELS: ""
MERGE_METHOD: "squash"
MERGE_COMMIT_MESSAGE: "pull-request-title"
MERGE_RETRIES: "10"
MERGE_RETRY_SLEEP: "10000"
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release

on:
push:
branches:
- master

jobs:
release:
name: 'Release NPM, GitHub, Docker'
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 13
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Generate bundle.js for the browser
run: npm run bundle
- name: Get version from package.json before release step
id: initversion
run: echo "::set-output name=version::$(npm run get-version --silent)"
- name: Release to NPM and GitHub
id: release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: asyncapi-bot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: asyncapi-bot
GIT_COMMITTER_EMAIL: [email protected]
run: npm run release
- name: Get version from package.json after release step
id: extractver
run: echo "::set-output name=version::$(npm run get-version --silent)"
- name: Create Pull Request with updated package files
if: steps.initversion.outputs.version != steps.extractver.outputs.version
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GH_TOKEN }}
commit-message: 'chore(release): ${{ steps.extractver.outputs.version }}'
committer: asyncapi-bot <[email protected]>
author: asyncapi-bot <[email protected]>
title: 'chore(release): ${{ steps.extractver.outputs.version }}'
body: 'Version bump in package.json and package-lock.json for release [${{ steps.extractver.outputs.version }}](https://github.com/${{github.repository}}/releases/tag/v${{ steps.extractver.outputs.version }})'
branch: version-bump/${{ steps.extractver.outputs.version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.vscode
dist
1 change: 0 additions & 1 deletion .npmrc.template

This file was deleted.

8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Overview

Contributions are more than welcome. If you want to contribute, please make sure you go through the following steps:

1. Pick or create an issue.
- It's always a good idea to leave a message saying that you're going to work on it before you start any actual work.
- Consider contacting us on [slack](https://www.asyncapi.com/slack-invite/) to discuss the topic first
2. Fork the repository and work there.
3. Open a Pull Request pointing to the `master` branch.
4. A maintainer will review and, eventually, merge your Pull Request. Please, be patient as most of us are doing this in our spare time.

## Conventional commits

This project follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) specification. Releasing to GitHub and NPM is done with the support of [semantic-release](https://semantic-release.gitbook.io/semantic-release/).

Pull requests should have a title that follows the specification, otherwise, merging is blocked. If you are not familiar with the specification simply ask maintainers to modify. You can also use this cheatsheet if you want:

- `fix: ` prefix in the title indicates that PR is a bug fix and PATCH release must be triggered.
- `feat: ` prefix in the title indicates that PR is a feature and MINOR release must be triggered.
- `docs: ` prefix in the title indicates that PR is only related to the documentation and there is no need to trigger release.
- `chore: ` prefix in the title indicates that PR is only related to cleanup in the project and there is no need to trigger release.
- `test: ` prefix in the title indicates that PR is only related to tests and there is no need to trigger release.
- `refactor: ` prefix in the title indicates that PR is only related to refactoring and there is no need to trigger release.

What about MAJOR release? just add `!` to the prefix, like `fix!: ` or `refactor!: `

Prefix that follows specification is not enough though. Remember that the title must be clear and descriptive with usage of [imperative mood](https://chris.beams.io/posts/git-commit/#imperative).

Happy contributing :heart:
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ This package is under development and it has not reached version 1.0.0 yet, what

---

Use this package to parse and validate AsyncAPI documents —either YAML or JSON— in your Node.js or browser application.
Use this package to parse and validate AsyncAPI documents —either YAML or JSON— in your Node.js or browser application. Updated bundle for the browser is always attached to the GitHub Release.

> This package doesn't support AsyncAPI 1.x.
### Install

```
npm install asyncapi-parser
npm install @asyncapi/parser
```

### API
Expand All @@ -33,7 +33,7 @@ npm install asyncapi-parser
##### Example passing inline AsyncAPI

```js
const parser = require('asyncapi-parser');
const parser = require('@asyncapi/parser');

const doc = await parser.parse(`
asyncapi: '2.0.0'
Expand Down Expand Up @@ -63,7 +63,7 @@ console.log(doc.info().title());
##### Example passing a URL

```js
const parser = require('asyncapi-parser');
const parser = require('@asyncapi/parser');

const doc = await parser.parseUrl('https://my.server.com/example-asyncapi.yaml');

Expand All @@ -86,3 +86,7 @@ Head over to [asyncapi/raml-dt-schema-parser](https://www.github.com/asyncapi/ra
1. Make sure all tests pass `npm test`
1. Generate new API docs `npm run docs`
1. Update bundle for client-side parser `npm run bundle`

## Contributing

Read [CONTRIBUTING](CONTRIBUTING.md) guide.
Empty file removed dist/.keep
Empty file.
1 change: 0 additions & 1 deletion dist/bundle.js

This file was deleted.

Loading

0 comments on commit 617bd02

Please sign in to comment.