-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into main_skl_flbot
- Loading branch information
Showing
3 changed files
with
53 additions
and
154 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 |
---|---|---|
|
@@ -30,13 +30,18 @@ on: | |
- main | ||
|
||
jobs: | ||
check_commit: | ||
combined_job: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
skip: ${{ steps.check.outputs.skip }} | ||
version: ${{ steps.bump_version_and_set_output.outputs.new_version }} | ||
changelog: ${{ steps.generate.outputs.changelog }} | ||
version_changes: ${{ steps.extract_changes.outputs.version_changes }} | ||
steps: | ||
# Checkout | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
# Check commit message | ||
- id: check | ||
run: | | ||
MESSAGE=$(git log -1 --pretty=%B) | ||
|
@@ -45,30 +50,29 @@ jobs: | |
else | ||
echo "::set-output name=skip::false" | ||
fi | ||
bump_version: | ||
runs-on: ubuntu-latest | ||
needs: check_commit | ||
if: needs.check_commit.outputs.skip != 'true' | ||
outputs: | ||
version: ${{ steps.bump_version_and_set_output.outputs.new_version }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
# If commit message doesn't contain "[skip ci]", continue to the next steps | ||
- name: Set up Python | ||
if: steps.check.outputs.skip != 'true' | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
|
||
- uses: actions/setup-node@v3 | ||
if: steps.check.outputs.skip != 'true' | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install Ganesh-CLI | ||
if: steps.check.outputs.skip != 'true' | ||
run: npm install -g ganache | ||
|
||
- name: Install Dependencies | ||
if: steps.check.outputs.skip != 'true' | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt --force-reinstall | ||
- name: Setup Brownie | ||
run: | | ||
pip install bumpversion | ||
brownie networks import ./brownie-config.yaml true | ||
brownie networks delete mainnet | ||
brownie networks add "Ethereum Mainnet" "mainnet" host="https://eth-mainnet.alchemyapi.io/v2/$WEB3_ALCHEMY_PROJECT_ID" chainid=1 | ||
|
@@ -77,9 +81,9 @@ jobs: | |
TENDERLY_FORK: '${{ secrets.TENDERLY_FORK }}' | ||
WEB3_ALCHEMY_PROJECT_ID: '${{ secrets.WEB3_ALCHEMY_PROJECT_ID }}' | ||
ETHERSCAN_TOKEN: '${{ secrets.ETHERSCAN_TOKEN }}' | ||
- name: Install bumpversion | ||
run: pip install bumpversion | ||
|
||
- name: Bump version and set output | ||
if: steps.check.outputs.skip != 'true' | ||
id: bump_version_and_set_output | ||
run: | | ||
CURRENT_VERSION=$(python -c "import fastlane_bot; print(fastlane_bot.__version__)") | ||
|
@@ -89,171 +93,57 @@ jobs: | |
NEW_VERSION="${MAJOR}.$((MINOR + 1)).${PATCH}" | ||
echo new_version=$NEW_VERSION >> $GITHUB_OUTPUT | ||
BRANCH_NAME="version-bump-$NEW_VERSION-run-$GITHUB_RUN_NUMBER" | ||
git checkout -b $BRANCH_NAME | ||
sed -i "s/$CURRENT_VERSION/$NEW_VERSION/" fastlane_bot/__init__.py | ||
git checkout main | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git commit -m "Bump version [skip ci]" -a | ||
- name: Push changes | ||
run: | | ||
git config --global push.autoSetupRemote true | ||
git push origin $BRANCH_NAME | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
- name: Create Pull Request | ||
id: create_pull_request | ||
run: | | ||
gh pr create --title "Bump version [skip ci]" --body "Automatic version bump" --head "$BRANCH_NAME" --base "main" > pr.txt | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
- name: Merge pull request | ||
run: | | ||
PR_URL=$(cat pr.txt) | ||
PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') | ||
gh pr merge $PR_NUMBER --admin --merge | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
generate_changelog: | ||
if: needs.check_commit.outputs.skip != 'true' | ||
needs: [ bump_version,check_commit ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
git add fastlane_bot/__init__.py | ||
git commit -m "Bump version [skip ci]" | ||
- name: Generate changelog | ||
if: steps.check.outputs.skip != 'true' | ||
uses: heinrichreimer/[email protected] | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
output: 'CHANGELOG.md' | ||
configureSections: '{"Merged pull requests": {"labels": ["pull-request"]}, "Fixed bugs": {"labels": ["bug"]}, "Implemented enhancements": {"labels": ["enhancement"]}, "Closed issues": {"labels": ["closed-issue"]}}' | ||
configureSections: '{"Merged pull requests": {"labels": ["pull-request","Merge pull request"]}, "Fixed bugs": {"labels": ["bug","bugfix"]}, "Implemented enhancements": {"labels": ["enhancement","feature"]}, "Closed issues": {"labels": ["closed-issue"]}}' | ||
bugsLabel: 'Fixed bugs' | ||
enhancementLabel: 'Implemented enhancements' | ||
issuesLabel: 'Closed issues' | ||
prLabel: 'Merged pull requests' | ||
compareLink: true | ||
addSections: '{"Security fixes": {"labels": ["security"]}, "Breaking changes": {"labels": ["breaking"]}}' | ||
- name: Create branch for changelog update | ||
run: | | ||
BRANCH_NAME="update-changelog-${{ github.run_number }}" | ||
git checkout -b $BRANCH_NAME | ||
- name: Commit and push changelog update | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git config --global push.autoSetupRemote true | ||
git add CHANGELOG.md | ||
git commit -m "Bump version [skip ci]" | ||
git push origin HEAD | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
- name: Create Pull Request for changelog update | ||
run: | | ||
gh pr create --title "Bump version [skip ci]" --body "Automatic update of CHANGELOG.md" --head "$(git rev-parse --abbrev-ref HEAD)" --base "main" > pr.txt | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
- name: Merge pull request | ||
run: | | ||
PR_URL=$(cat pr.txt) | ||
PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') | ||
gh pr merge $PR_NUMBER --admin --merge | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
clean_changelog: | ||
needs: [generate_changelog,check_commit] | ||
if: needs.check_commit.outputs.skip != 'true' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
changelog: ${{ steps.generate.outputs.changelog }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Clean changelog | ||
run: | | ||
sed -i '/Bump version/d' CHANGELOG.md | ||
- name: Create branch for changelog cleaning | ||
run: | | ||
BRANCH_NAME="clean-changelog-${{ github.run_number }}" | ||
git checkout -b $BRANCH_NAME | ||
- name: Commit and push changelog cleaning | ||
|
||
- name: Commit changelog update | ||
if: steps.check.outputs.skip != 'true' | ||
run: | | ||
git checkout main | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git config --global push.autoSetupRemote true | ||
git add CHANGELOG.md | ||
git commit -m "Bump version [skip ci]" | ||
git push origin HEAD | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
- name: Create Pull Request for changelog cleaning | ||
run: | | ||
gh pr create --title "Bump version [skip ci]" --body "Automatic cleaning of CHANGELOG.md" --head "$(git rev-parse --abbrev-ref HEAD)" --base "main" > pr.txt | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
- name: Merge pull request | ||
run: | | ||
PR_URL=$(cat pr.txt) | ||
PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') | ||
gh pr merge $PR_NUMBER --admin --merge | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
release: | ||
needs: [ bump_version,check_commit,generate_changelog,clean_changelog ] | ||
if: needs.check_commit.outputs.skip != 'true' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version_changes: ${{ steps.extract_changes.outputs.version_changes }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
git commit -m "Update changelog [skip ci]" | ||
# push to main branch using CasperWA/push-protected@v2 action | ||
- name: Push to protected branch | ||
if: steps.check.outputs.skip != 'true' | ||
uses: CasperWA/push-protected@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Extract version changes from CHANGELOG.md | ||
id: extract_changes | ||
run: | | ||
VERSION_CHANGES=$(sed -n "/\[v${{ needs.bump_version.outputs.version }}\]/,/\[v.*\]/p" CHANGELOG.md | head -n -2) | ||
echo "::set-output name=version_changes::$VERSION_CHANGES" | ||
token: ${{ secrets.GH_TOKEN }} | ||
branch: main | ||
|
||
- name: Create Release | ||
if: steps.check.outputs.skip != 'true' | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
with: | ||
tag_name: v${{ needs.bump_version.outputs.version }} | ||
release_name: Release v${{ needs.bump_version.outputs.version }} | ||
tag_name: v${{ steps.bump_version_and_set_output.outputs.new_version }} | ||
release_name: Release v${{ steps.bump_version_and_set_output.outputs.new_version }} | ||
body: ${{ steps.extract_changes.outputs.version_changes }} | ||
draft: false | ||
prerelease: false | ||
publish: | ||
if: needs.check_commit.outputs.skip != 'true' | ||
needs: [release,check_commit] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Install Ganesh-CLI | ||
run: npm install -g ganache | ||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt --force-reinstall | ||
- name: Setup Brownie | ||
run: | | ||
brownie networks import ./brownie-config.yaml true | ||
brownie networks delete mainnet | ||
brownie networks add "Ethereum Mainnet" "mainnet" host="https://eth-mainnet.alchemyapi.io/v2/$WEB3_ALCHEMY_PROJECT_ID" chainid=1 | ||
brownie networks set_provider alchemy | ||
env: | ||
TENDERLY_FORK: '${{ secrets.TENDERLY_FORK }}' | ||
WEB3_ALCHEMY_PROJECT_ID: '${{ secrets.WEB3_ALCHEMY_PROJECT_ID }}' | ||
ETHERSCAN_TOKEN: '${{ secrets.ETHERSCAN_TOKEN }}' | ||
|
||
- name: Create .env file | ||
run: | | ||
echo TENDERLY_FORK=$TENDERLY_FORK > .env | ||
|
@@ -269,17 +159,23 @@ jobs: | |
ETHERSCAN_TOKEN: '${{ secrets.ETHERSCAN_TOKEN }}' | ||
DEFAULT_MIN_PROFIT_BNT: '${{ secrets.DEFAULT_MIN_PROFIT_BNT }}' | ||
ETH_PRIVATE_KEY_BE_CAREFUL: '${{ secrets.ETH_PRIVATE_KEY_BE_CAREFUL }}' | ||
|
||
- name: Install package | ||
run: | | ||
python setup.py install | ||
- name: Build package | ||
run: python setup.py sdist | ||
|
||
- name: Build wheel | ||
run: | | ||
pip install wheel | ||
python setup.py bdist_wheel | ||
- name: Publish package to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.FASTLANE_PYPI_API_TOKEN }} | ||
repository-url: https://upload.pypi.org/legacy/ | ||
repository-url: https://upload.pypi.org/legacy/ | ||
|
||
|
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from .bot import CarbonBot as Bot, __VERSION__, __DATE__ | ||
from .config import Config, ConfigNetwork, ConfigDB, ConfigLogger, ConfigProvider | ||
|
||
__version__ = '2.3.0' | ||
__version__ = '2.2.0' | ||
|
||
|
||
|