Wikipedia:WikiProject Articles for creation/Helper script/Deploying
Appearance
If you are an interface administrator and you would like to update AFCH's code on Wikipedia to match the code located at the official GitHub repository (basically deploying approved patches to production), follow this work instruction.
To update AFCH to its latest version onwiki, you need to do the following.
First time
[edit]- Special:BotPasswords
- Provide the permissions shown in the image to the right.
- Note down the password and save it in a text file.
- This is important especially if you have 2FA enabled (which you will need if you are a intadmin) since pywikibot cannot bypass 2FA and will be unable to login via non-BotPassword means.
- Note: BotPasswords are global, not specific to a wiki. For example, you only need to create one BotPassword, even if you want to deploy to both enwiki and testwiki.
Every time
[edit]- Note: For Windows, all commands need to be run on Git Bash and not in Powershell
- Create a python environment using the following command:
python -m venv venv
- Activate the Python environment.
- Windows
- Novem's desktop:
./venv/Scripts/activate
- Novem's laptop:
source venv/Scripts/activate
- Novem's desktop:
- Linux:
source ./venv/bin/activate
- Windows
- Install python packages using
pip install GitPython pywikibot
- Navigate (using
cd
) into the directory containing the git repository.
First time
[edit]- Run
pwb generate_user_files
- select
19: wikipedia
- select
en
- username (for example:
Novem Linguae
) - do you want to add other projects?
yes
- select
19: wikipedia
- select
test
- username (for example:
Novem Linguae
) - do you want to add other projects?
no
- do you want to provide a bot password?
yes
- bot name: (for example:
AFCH_deploy_script
) - password - this is broken on my laptop. i hit enter and nothing happens. try "add other projects?" = no? try a longer bot name such as
Novem Linguae@TwinkleDeployLaptop
? Try updating git bash version? - no
- no
- select
Every time
[edit]- Sync your GitHub forked repo to the AFCH repo.
- Make sure you don't have uncommitted changes. If you do, the deploy will fail silently.
git checkout master
git pull
- Run
npm install -g grunt-cli
- Run
npm install
- Run
pwb login
to login, verify that the last line saysLogged in on wikipedia:en as <your username>.
- If any files were created since the last time you deployed, create them onwiki with empty content. Else the deploy script will not be able to edit them.
- Depending on your wiki...
- testwiki:
python ./scripts/upload.py test MediaWiki:Gadget-afchelper
- enwiki:
python ./scripts/upload.py en MediaWiki:Gadget-afchelper
- testwiki:
- Double check all diffs carefully by visiting Special:MyContributions and looking for problems. There have been bugs in the past.
Troubleshooting
[edit]bash: pwb: command not found
on Windows- Close git bash, open a new git bash, then restart the work instruction's steps. But instead of doing
./venv/Scripts/activate
, dosource venv/Scripts/activate
- Close git bash, open a new git bash, then restart the work instruction's steps. But instead of doing
Editors familiar with the deploy script
[edit]Have deployed to enwiki before:
Knowledgeable of some of the process: