This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
WIP: feat: testing things #6
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: Deploy to DigitalOcean | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Create .env file | |
run: | | |
touch subnet/miner-cloudflare/.env | |
echo CLOUDFLARE_AUTH_TOKEN=${{ secrets.CLOUDFLARE_AUTH_TOKEN }} >> ./subnet/miner-cloudflare/.env | |
- name: Build Docker Image | |
run: docker build -t cloudflare-miner ./subnet/miner-cloudflare/ | |
- name: Create SSH key | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.CLOUDFLARE_MINER_SSH_PRIVATE_KEY }} | |
run: | | |
mkdir -p ~/.ssh | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
- name: Deploy to DigitalOcean | |
env: | |
DOCKER_HOST: ssh://root@${{ secrets.MINER_ADDRESS }} | |
run: | | |
docker save cloudflare-miner ./subnet/miner-cloudflare/.env | ssh -i ~/.ssh/id_ed25519 root@${{ secrets.MINER_ADDRESS }} "docker load" | |
docker rm -f cloudflare-miner || true | |
docker run -d --name cloudflare-miner-container -p 8080:8080 --env-file ./subnet/miner-cloudflare/.env cloudflare-miner | |
ssh -i ~/.ssh/id_ed25519 root@${{ secrets.MINER_ADDRESS }} "docker exec cloudflare-miner python main.py" |