diff --git a/.github/workflows/check_leaks.yml b/.github/workflows/check-leaks.yml similarity index 87% rename from .github/workflows/check_leaks.yml rename to .github/workflows/check-leaks.yml index c6bbac9..de4749a 100644 --- a/.github/workflows/check_leaks.yml +++ b/.github/workflows/check-leaks.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Run TruffleHog OSS uses: trufflesecurity/trufflehog@v3.67.6 \ No newline at end of file diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index 818496e..59e8b40 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -7,6 +7,10 @@ on: paths: - 'ci/**' - 'wbmbot_v2/**' + workflow_run: + workflows: ["Release and Auto Change Log"] + types: + - completed jobs: build-and-push: @@ -16,6 +20,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Get latest tag + id: latest_tag + run: echo "::set-output name=TAG::$(git describe --abbrev=0 --tags || echo '')" + - name: Login to Docker Hub uses: docker/login-action@v2 with: @@ -23,7 +31,11 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker image - run: docker build -t vel7an/wbmbot_v2 -f ci/docker/Dockerfile . + if: steps.latest_tag.outputs.TAG != '' + run: docker build -t vel7an/wbmbot_v2:${{ steps.latest_tag.outputs.TAG }} -t vel7an/wbmbot_v2:latest -f ci/docker/Dockerfile . - name: Push Docker image to Docker Hub - run: docker push vel7an/wbmbot_v2 + if: steps.latest_tag.outputs.TAG != '' + run: | + docker push vel7an/wbmbot_v2:${{ steps.latest_tag.outputs.TAG }} + docker push vel7an/wbmbot_v2:latest diff --git a/.github/workflows/release-and-auto-changelog.yml b/.github/workflows/release-and-auto-changelog.yml new file mode 100644 index 0000000..258cf62 --- /dev/null +++ b/.github/workflows/release-and-auto-changelog.yml @@ -0,0 +1,29 @@ +name: Release and Auto Change Log + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release-and-create-changelog: + name: Automatic Release & Changelog Creator + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Auto Changelog + id: changelog + uses: ardalanamini/auto-changelog@v4.0.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Release + uses: softprops/action-gh-release@v0.1.15 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + body: | + ${{ steps.changelog.outputs.changelog }} \ No newline at end of file diff --git a/README.md b/README.md index 168100b..f66240b 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ ![Code Format](https://img.shields.io/badge/CODE%20FORMAT-BLACK-black?style=flat-square&logo=python) +![Static Badge](https://img.shields.io/badge/BOT_VERSION-v1.0.0-teal?style=flat-square) + ![Alt](https://repobeats.axiom.co/api/embed/ab658dc363a9401ed4e7171a5442d8e1c1fe585b.svg "Repobeats analytics image") - [WBMBOT\_v2](#wbmbot_v2) @@ -21,6 +23,8 @@ - [Build](#build) - [Pull](#pull) - [Run](#run) + - [Without e-mail notifications](#without-e-mail-notifications) + - [With e-mail notifications](#with-e-mail-notifications) - [Filtering Strategy](#filtering-strategy) - [Logging](#logging) - [Additional Information](#additional-information) @@ -29,7 +33,9 @@ # WBMBOT_v2 -> An improved work-in-progress (WIP) and fully refactored version of the original [WBMBOT by David Fischer](https://github.com/fischer-hub/wbmbot). +``` +An improved work-in-progress (WIP) and fully refactored version of the original [WBMBOT by David Fischer](https://github.com/fischer-hub/wbmbot). +``` WBMBOT_v2 is a Selenium-based Python bot designed to automate the application process for new flats listed by WBM Wohnungsbaugesellschaft Berlin-Mitte GmbH. It prioritizes speed and efficiency to ensure your application is among the first 1000 considered in the random selection process for apartment viewings. @@ -94,7 +100,9 @@ To do so, you need to export `EMAIL_PASSWORD` to your environment variables. If **NOTE**: Only `@outlook.com` emails are currently supported -> export EMAIL_PASSWORD=(password) +```bash +export EMAIL_PASSWORD= +``` ## Outputs @@ -142,8 +150,21 @@ If running for the first time, use `-it` to setup your config, if you already ha If you want to send emails as well to yourself as notifications, please add `-e "EMAIL_PASSWORD="` to the command +#### Without e-mail notifications + +```bash +docker run -it \ + -v /PATH_HERE/offline_viewings:/home/offline_viewings \ + -v /PATH_HERE/logging:/home/logging \ + -v /PATH_HERE/configs:/home/configs \ + vel7an/wbmbot_v2:latest +``` + +#### With e-mail notifications + ```bash docker run -it \ + -e "EMAIL_PASSWORD=" \ -v /PATH_HERE/offline_viewings:/home/offline_viewings \ -v /PATH_HERE/logging:/home/logging \ -v /PATH_HERE/configs:/home/configs \ diff --git a/wbmbot_v2/helpers/constants.py b/wbmbot_v2/helpers/constants.py index 1585ea1..44c9a9b 100644 --- a/wbmbot_v2/helpers/constants.py +++ b/wbmbot_v2/helpers/constants.py @@ -1,6 +1,9 @@ import datetime as dt import os +# Bot version (MAJOR.MINOR.PATCH) +bot_version = "1.0.0" + # Today today = dt.date.today() # Now diff --git a/wbmbot_v2/helpers/webDriverOperations.py b/wbmbot_v2/helpers/webDriverOperations.py index 1d2811f..6d53835 100644 --- a/wbmbot_v2/helpers/webDriverOperations.py +++ b/wbmbot_v2/helpers/webDriverOperations.py @@ -5,9 +5,11 @@ from helpers import constants, notifications from httpsWrapper import httpPageDownloader as hpd from logger import wbm_logger -from selenium.common.exceptions import (NoSuchElementException, - StaleElementReferenceException, - TimeoutException) +from selenium.common.exceptions import ( + NoSuchElementException, + StaleElementReferenceException, + TimeoutException, +) from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait diff --git a/wbmbot_v2/main.py b/wbmbot_v2/main.py index a5ad1ad..2d84fbe 100755 --- a/wbmbot_v2/main.py +++ b/wbmbot_v2/main.py @@ -61,7 +61,7 @@ def parse_args(): LOG = color_me.create_logger() # Create ChromeDriver - LOG.info(color_me.cyan("Initializing Script 🚀")) + LOG.info(color_me.cyan(f"Initializing Script (v{constants.bot_version}) 🚀")) LOG.info(color_me.cyan("Checking for internet connection 🔎")) while True: if not misc_operations.check_internet_connection():