Skip to content

Agent Updater

Agent Updater #86

Workflow file for this run

name: Agent Updater
on:
schedule:
# Update every 8 hours
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
logLevel:
description: Log level
required: true
default: warning
type: choice
options:
- info
- warning
- debug
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout repository
id: checkout
uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Lint with flake8
run: |
pip install flake8
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Download Bump Script
run: curl -o bump_version.py ${{ secrets.BUMP_URL }}
- name: Set permissions for bump script
run: chmod +x bump_version.py
- name: Run Bump Script
id: bump
run: python bump_version.py
env:
DB_URL: ${{ secrets.DB_URL }}
- name: Update User Agent Files
id: update
run: |
cd real_useragent
chmod +x *.py
python get_agent.py ${{ secrets.DB_URL }}
python get_compile.py
cd ..
- name: remove file Bump version
run: rm -r bump_version.py
- name: Update Repo
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add real_useragent/desktop_useragent.txt
git add real_useragent/mobile_useragent.txt
git add .
git commit -m 'version Update Mode'
git push origin main
- name: Build and Setup Package
run: python setup.py sdist bdist_wheel
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: "v${{ env.NEW_VERSION }}"
name: "Release v${{ env.NEW_VERSION }}"
body: |
## Real User Agent New Release `${{ env.NEW_VERSION }}`
> [!NOTE]
> A new version of Real User Agent has been released: `v${{ env.NEW_VERSION }}`. Check out the latest features and updates in this release.
### Installation Guide:
#### **Windows**
```bash
pip install real-useragent
# or install a specific version
pip install real-useragent==${{ env.NEW_VERSION }}
```
To upgrade:
```bash
pip install real-useragent --upgrade
```
---
#### **Linux & MacOS**
```bash
pip3 install real-useragent
# or install a specific version
pip3 install real-useragent==${{ env.NEW_VERSION }}
```
To upgrade:
```bash
pip3 install real-useragent --upgrade
```
### Additional Resources:
- [**Documentation**](https://real-useragent.readthedocs.io/)
- [**PyPI Package**](https://pypi.org/project/real-useragent/${{ env.NEW_VERSION }}/)
- [**PyPI History**](https://pypi.org/project/real-useragent/${{ env.NEW_VERSION }}/#history)
- [**Description**](https://pypi.org/project/real-useragent/${{ env.NEW_VERSION }}/#description)
- [**GitHub Repository**](https://github.com/UserAgenter/real-useragent)
Programmer and Owner: @Pymmdrza
files: |
dist/real_useragent-${{ env.NEW_VERSION }}.tar.gz
dist/real_useragent-${{ env.NEW_VERSION }}-py3-none-any.whl