S7 update (#109) #368
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install flake8 | |
run: pip install flake8 | |
- name: Run flake8 | |
run: flake8 | |
- name: Install requirements | |
run: pip install -e . | |
- name: Run tests | |
run: python -m unittest discover -s randobot/tests -p 'test_*.py' | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.repository == 'wooferzfg/tww-rando-bot' && github.ref == 'refs/heads/main' | |
concurrency: deploy | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v3 | |
# For initial setup, launch an Amazon Linux 2 AMI instance and run the following commands: | |
# | |
# sudo yum install -y docker git | |
# sudo service docker start | |
# sudo usermod -aG docker ec2-user | |
# Install docker compose plugin: https://docs.docker.com/compose/install/linux/#install-the-plugin-manually | |
- name: Deploy using SSH | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EC2_ADDRESS }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_RSA_KEY }} | |
script: | | |
docker stop $(docker ps -aq) || true | |
docker rm $(docker ps -aq) || true | |
docker system prune -af || true | |
sudo rm -r tww-rando-bot || true | |
git clone --recursive https://github.com/wooferzfg/tww-rando-bot.git | |
echo "${{ secrets.WWRANDO_SEED_KEY }}" > tww-rando-bot/wwrando/keys/seed_key.py | |
echo "${{ secrets.WWRANDO_DEV_TANJO3_SEED_KEY }}" > tww-rando-bot/wwrando-s7/keys/seed_key.py | |
echo "${{ secrets.WWRANDO_RS_SEED_KEY }}" > tww-rando-bot/wwrando-random-settings/keys/seed_key.py | |
cd tww-rando-bot | |
export GITHUB_TOKEN=${{ secrets.BOT_GITHUB_TOKEN }} | |
export CLIENT_ID=${{ secrets.RACETIME_CLIENT_ID }} | |
export CLIENT_SECRET=${{ secrets.RACETIME_CLIENT_SECRET }} | |
docker compose build --no-cache --pull | |
docker compose up -d |