-
Notifications
You must be signed in to change notification settings - Fork 41
chore(maintenance): general maintencance and ci flow #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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: Create release PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "The new version number with 'v' prefix. Example: v1.40.1" | ||
required: true | ||
|
||
jobs: | ||
init_release: | ||
name: 🚀 Create release PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # gives the changelog generator access to all previous commits | ||
|
||
- name: Update CHANGELOG.md, __pkg__.py and push release branch | ||
env: | ||
VERSION: ${{ github.event.inputs.version }} | ||
run: | | ||
npx --yes standard-version@9.3.2 --release-as "$VERSION" --skip.tag --skip.commit --tag-prefix=v | ||
git config --global user.name 'github-actions' | ||
git config --global user.email 'release@getstream.io' | ||
git checkout -q -b "release-$VERSION" | ||
git commit -am "chore(release): $VERSION" | ||
git push -q -u origin "release-$VERSION" | ||
|
||
- name: Get changelog diff | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const get_change_log_diff = require('./scripts/get_changelog_diff.js') | ||
core.exportVariable('CHANGELOG', get_change_log_diff()) | ||
|
||
- name: Open pull request | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh pr create \ | ||
-t "chore(release): ${{ github.event.inputs.version }}" \ | ||
-b "# :rocket: ${{ github.event.inputs.version }} | ||
Make sure to use squash & merge when merging! | ||
Once this is merged, another job will kick off automatically and publish the package. | ||
# :memo: Changelog | ||
${{ env.CHANGELOG }}" |
This file contains hidden or 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,48 @@ | ||
name: Release | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- main | ||
|
||
jobs: | ||
Release: | ||
name: 🚀 Release | ||
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const get_change_log_diff = require('./scripts/get_changelog_diff.js') | ||
core.exportVariable('CHANGELOG', get_change_log_diff()) | ||
|
||
// Getting the release version from the PR source branch | ||
// Source branch looks like this: release-1.0.0 | ||
const version = context.payload.pull_request.head.ref.split('-')[1] | ||
core.exportVariable('VERSION', version) | ||
|
||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Publish to PyPi | ||
env: | ||
TWINE_USERNAME: "__token__" | ||
TWINE_PASSWORD: "${{ secrets.PYPI_TOKEN }}" | ||
ferhatelmas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run: | | ||
pip install -q twine==3.7.1 wheel==0.37.1 | ||
python setup.py sdist bdist_wheel | ||
twine upload --non-interactive dist/* | ||
|
||
- name: Create release on GitHub | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
body: ${{ env.CHANGELOG }} | ||
tag: ${{ env.VERSION }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or 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,30 @@ | ||
name: reviewdog | ||
on: | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
reviewdog: | ||
name: 🐶 Reviewdog | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: reviewdog/action-setup@v1 | ||
with: | ||
reviewdog_version: latest | ||
|
||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
ferhatelmas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Install deps | ||
run: pip install ".[ci]" | ||
|
||
- name: Reviewdog | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: make reviewdog |
This file contains hidden or 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 |
---|---|---|
|
@@ -53,6 +53,8 @@ coverage.xml | |
# Sphinx documentation | ||
docs/_build/ | ||
|
||
|
||
.python-version | ||
secrets.*sh | ||
.idea | ||
.vscode/ | ||
|
This file contains hidden or 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,16 @@ | ||
const pkgUpdater = { | ||
VERSION_REGEX: /__version__ = "(.+)"/, | ||
|
||
readVersion: function (contents) { | ||
const version = this.VERSION_REGEX.exec(contents)[1]; | ||
return version; | ||
}, | ||
|
||
writeVersion: function (contents, version) { | ||
return contents.replace(this.VERSION_REGEX.exec(contents)[0], `__version__ = "${version}"`); | ||
} | ||
} | ||
|
||
module.exports = { | ||
bumpFiles: [{ filename: './stream/__init__.py', updater: pkgUpdater }], | ||
} |
This file contains hidden or 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
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,26 @@ | ||
/* | ||
Here we're trying to parse the latest changes from CHANGELOG.md file. | ||
The changelog looks like this: | ||
|
||
## 0.0.3 | ||
- Something #3 | ||
## 0.0.2 | ||
- Something #2 | ||
## 0.0.1 | ||
- Something #1 | ||
|
||
In this case we're trying to extract "- Something #3" since that's the latest change. | ||
*/ | ||
module.exports = () => { | ||
const fs = require('fs') | ||
|
||
changelog = fs.readFileSync('CHANGELOG.md', 'utf8') | ||
releases = changelog.match(/## [?[0-9](.+)/g) | ||
|
||
current_release = changelog.indexOf(releases[0]) | ||
previous_release = changelog.indexOf(releases[1]) | ||
|
||
latest_changes = changelog.substr(current_release, previous_release - current_release) | ||
|
||
return latest_changes | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.