From 7ed8c709f81efa1b976b6b0f370ce9869f8be08d Mon Sep 17 00:00:00 2001 From: Lukasz Gornicki Date: Wed, 25 Mar 2020 07:43:37 +0100 Subject: [PATCH] feat: introduce automated releasing to GitHub (#16) Co-Authored-By: Karolina Zydek --- .github/workflows/.releaserc | 16 +++++++++ .github/workflows/release.yml | 61 +++++++++++++++++++++++++++++++++++ .travis.yml | 25 -------------- CONTRIBUTING.md | 27 ++++++++++++---- README.md | 2 ++ 5 files changed, 100 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/.releaserc create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/.releaserc b/.github/workflows/.releaserc new file mode 100644 index 0000000..401bce8 --- /dev/null +++ b/.github/workflows/.releaserc @@ -0,0 +1,16 @@ +--- +branches: +- master +plugins: +- - "@semantic-release/commit-analyzer" + - preset: conventionalcommits +- - "@semantic-release/release-notes-generator" + - preset: conventionalcommits +- - "@semantic-release/github" + - assets: + - path: asyncapi-converter.darwin.amd64 + label: Binary - Darwin AMD64 + - path: asyncapi-converter.linux.amd64 + label: Binary - Linux AMD64 + - path: asyncapi-converter.windows.amd64.exe + label: Binary - Windows AMD64 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c23b331 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +name: Release + +on: + push: + branches: + - master + +jobs: + test: + name: 'Testing' + runs-on: ubuntu-latest + strategy: + matrix: + go: + - '1.14' + - '1.13' + - '1.12' + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v1.1.2 + with: + go-version: '${{ matrix.go }}' + - name: Invoking go test + run: go test ./... + + release: + name: 'Release to GitHub' + runs-on: ubuntu-latest + needs: + - test + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v1.1.2 + with: + go-version: '1.14' + - name: Invoking go vet and binaries generation + run: | + go vet ./... + GOOS=darwin GOARCH=amd64 go build -o=.github/workflows/asyncapi-converter.darwin.amd64 ./cmd/api-converter/main.go + GOOS=linux GOARCH=amd64 go build -o=.github/workflows/asyncapi-converter.linux.amd64 ./cmd/api-converter/main.go + GOOS=windows GOARCH=amd64 go build -o=.github/workflows/asyncapi-converter.windows.amd64.exe ./cmd/api-converter/main.go + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 13 + - name: Add plugin for conventional commits + run: npm install conventional-changelog-conventionalcommits + working-directory: ./.github/workflows + - name: Release to GitHub + working-directory: ./.github/workflows + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + GIT_AUTHOR_NAME: asyncapi-bot + GIT_AUTHOR_EMAIL: info@asyncapi.io + GIT_COMMITTER_NAME: asyncapi-bot + GIT_COMMITTER_EMAIL: info@asyncapi.io + run: npx semantic-release diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6dc2f2b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: go - -go: - - 1.12.x - -env: - - GO111MODULE=on - -script: - - go vet ./... - - go test ./... - - env GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${TRAVIS_BUILD_NUMBER}" -o=api-converter.darwin.amd64 ./cmd/api-converter/main.go - - env GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${TRAVIS_BUILD_NUMBER}" -o=api-converter.linux.amd64 ./cmd/api-converter/main.go - - env GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=${TRAVIS_BUILD_NUMBER}" -o=api-converter.windows.amd64.exe ./cmd/api-converter/main.go - -deploy: - provider: releases - api_key: $GH_TOKEN - file: - - api-converter.darwin.amd64 - - api-converter.linux.amd64 - - api-converter.windows.amd64.exe - skip_cleanup: true - on: - tags: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 743d008..abd9253 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,18 +6,33 @@ Learn the rules to follow when you contribute code or content to this project. ## Contributing process -The contributing process in this project relies on the [GitHub flow](https://guides.github.com/introduction/flow/index.html). This means that you contribute through pull requests. When adding new code or content to this project, follow these rules: +The contributing process in this project relies on the [GitHub flow](https://guides.github.com/introduction/flow/index.html). This means that you contribute through pull requests (PRs). When adding new code or content to this project, follow these rules: 1. Fork this repository. -2. Make your changes. Do not forgot about: +1. Make your changes. Do not forgot about: - [Naming and architecture convention](./DEVELOPMENT.md#naming--architecture-convention) - [Project structure](./development-guide.md/#project-structure) - Tests - Updating relevant documents if you add, remove, update props, configuration, or themes -3. Squash your changes to a single commit. Write a concise commit message in the imperative mood, as described [here](https://chris.beams.io/posts/git-commit/). -4. Rebase your changes to the latest `master` branch. -5. Create a pull request. +1. Create a PR. > **NOTE:** When you add content to the `converter-go` repository, follow the [guidelines](https://github.com/kyma-project/community/tree/master/guidelines/content-guidelines) from the `kyma-project` organization. -Pull requests are very welcome. However, if you want to add a new feature, use GitHub issues to discuss your ideas first. \ No newline at end of file +PRs are very welcome. However, if you want to add a new feature, use GitHub issues to discuss your ideas first. + +## Conventional commits + +This project follows the [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/). + +A PR 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 the PR. You can also use this cheatsheet: + +- `fix: ` prefix in the title indicates that a PR is a bug fix and the PATCH release must be triggered. +- `feat: ` prefix in the title indicates that a PR is a feature and the MINOR release must be triggered. +- `docs: ` prefix in the title indicates that a PR is only related to the documentation and there is no need to trigger a release. +- `chore: ` prefix in the title indicates that a PR is only related to the project cleanup and there is no need to trigger a release. +- `test: ` prefix in the title indicates that a PR is only related to tests and there is no need to trigger a release. +- `refactor: ` prefix in the title indicates that a PR is only related to refactoring and there is no need to trigger a release. + +For a MAJOR release, just add `!` to the prefix, like `fix!: ` or `refactor!: `. + +A prefix that follows the specification is not enough though. Remember that the title must be clear, descriptive, and in the [imperative mood](https://chris.beams.io/posts/git-commit/#imperative). diff --git a/README.md b/README.md index dd36c7f..31066ad 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ To install the AsyncAPI Converter package, run: go get github.com/asyncapi/converter-go/... ``` +> **TIP:** You can also get binaries from the [latest GitHub release](https://github.com/asyncapi/converter-go/releases/latest). + ## Usage You can use the AsyncAPI Converter in the terminal or as a package.