-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (53 loc) · 1.98 KB
/
python-app.yml
File metadata and controls
59 lines (53 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
workflow_dispatch:
inputs:
BOT_ID:
description: 'Your Main Bot ID'
required: true
OLD_URI:
description: 'Old MongoDB URI'
required: true
OLD_DBNAME:
description: 'Old Database Name'
required: true
default: 'F2LxBot'
NEW_URI:
description: 'New MongoDB URI'
required: true
NEW_DBNAME:
description: 'New Database Name'
required: true
default: 'TGFS'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Hide the inputs values to keep them private in the logs when running this workflow
uses: levibostian/action-hide-sensitive-inputs@v1
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Setup MongoDB Tools
run: |
wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2404-x86_64-100.14.1.deb -O mongo-tools.deb
sudo apt install ./mongo-tools.deb
- name: Verify mongorestore installation
run: mongorestore --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: create dump
run: mongodump --uri=${{ github.event.inputs.OLD_URI }} --db=${{ github.event.inputs.OLD_DBNAME }} --out="oldbson"
- name: process dump
run: python3 migrate_old.py ${{ github.event.inputs.OLD_DBNAME }} ${{ github.event.inputs.NEW_DBNAME }} ${{ github.event.inputs.BOT_ID }}
- name: restore processed dump
run: mongorestore --uri=${{ github.event.inputs.NEW_URI }} ./mongodump