-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new release workflow with automated release publishing (#242)
- Loading branch information
Showing
10 changed files
with
8,454 additions
and
1,856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 automatically close the issue after the merge. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
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: 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: Release to Docker | ||
if: steps.initversion.outputs.version != steps.extractver.outputs.version | ||
run: | | ||
echo ${{secrets.DOCKER_PASSWORD}} | docker login -u ${{secrets.DOCKER_USERNAME}} --password-stdin | ||
npm run docker-build | ||
docker tag asyncapi/generator:latest asyncapi/generator:${{ steps.extractver.outputs.version }} | ||
docker push asyncapi/generator:${{ steps.extractver.outputs.version }} | ||
docker push asyncapi/generator:latest | ||
- 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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## 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. | ||
|
||
### Developing with Docker | ||
|
||
In case you want to quickly build a docker image locally to check if it works then run `npm run docker-build` | ||
|
||
## 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.