From 955991ed1a15d88a243b29aadaf71918daef8114 Mon Sep 17 00:00:00 2001
From: ShadowMoose <theshadowmoose@gmail.com>
Date: Fri, 27 May 2022 20:11:57 -0700
Subject: [PATCH] Automatically inject new release version on publish.

---
 .github/workflows/python-publish.yml | 5 +++++
 pyderman/__init__.py                 | 2 --
 setup.cfg                            | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml
index 450381f..12f192d 100644
--- a/.github/workflows/python-publish.yml
+++ b/.github/workflows/python-publish.yml
@@ -17,10 +17,15 @@ jobs:
 
     steps:
     - uses: actions/checkout@v3
+
     - name: Set up Python
       uses: actions/setup-python@v3
       with:
         python-version: '3.x'
+
+    - name: Inject release tag version
+      run: sed -i "s/INJECTED_PYDERMAN_VERSION/${{ github.event.release.tag_name }}/" setup.cfg
+
     - name: Install dependencies
       run: |
         python -m pip install --upgrade pip
diff --git a/pyderman/__init__.py b/pyderman/__init__.py
index 0ea915f..58f2a59 100644
--- a/pyderman/__init__.py
+++ b/pyderman/__init__.py
@@ -14,8 +14,6 @@
 from pyderman.drivers import all_drivers, chrome, edge, firefox, opera, phantomjs
 from pyderman.util import downloader
 
-__version__ = "3.2.1"
-
 _versions = sorted(["32", "64"], key=lambda _v: not platform.machine().endswith(_v))
 _os_opts = [("win", "win", ".exe"), ("darwin", "mac", ""), ("linux", "linux", "")]
 
diff --git a/setup.cfg b/setup.cfg
index e55535e..725672e 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = pyderman
-version = attr: pyderman.__version__
+version = INJECTED_PYDERMAN_VERSION
 description = Installs the latest Chrome/Firefox/Opera/PhantomJS/Edge web drivers automatically.
 long_description = file: README.md
 long_description_content_type = text/markdown