Fix stock images #76
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: wb.matakov.com workflow | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
magic_deploy: | |
name: Deploy to server with remote docker-compose | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install SSH key to github server | |
uses: kielabokkie/ssh-key-and-known-hosts-action@v1.1.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_KEY }} | |
ssh-host: ${{ secrets.IP_HOST }} | |
- name: Install latest version of docker with experimental compose support | |
run: | | |
pip install docker-compose | |
- name: Generate env file from Base64 encoded string (base64 -i .env) | |
uses: RollyPeres/base64-to-path@v1 | |
with: | |
filePath: ${{ github.workspace }}/.env | |
encodedString: ${{ secrets.ENV }} | |
- name: Remote docker compose down/up using context (zero files) | |
run: | | |
docker context create remote --docker "host=ssh://${{ secrets.SSH_USER }}@${{ secrets.IP_HOST }}" | |
docker context use remote | |
docker image prune -f | |
docker build -t matakov/wb:latest . | |
docker-compose --context remote -f docker-compose-prod.yaml down | |
docker-compose --context remote -f docker-compose-prod.yaml up -d --force-recreate | |
send_message: | |
name: Send telegram notification | |
runs-on: ubuntu-latest | |
needs: magic_deploy | |
steps: | |
- name: Send message | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: ${{ github.workflow }} done! |