test commit #46
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: gRPC/Telegram bot CI/CD | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
solar-system-info-server-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: kudryashovroman/solar-system-info | |
path: . | |
dockerfile: ./grpc-telegram-bot/server/Dockerfile | |
tags: server | |
push: ${{ github.event_name == 'push' }} | |
solar-system-info-bot-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: kudryashovroman/solar-system-info | |
path: . | |
dockerfile: ./grpc-telegram-bot/bot/Dockerfile | |
tags: bot | |
push: ${{ github.event_name == 'push' }} | |
nginx-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: kudryashovroman/solar-system-info | |
path: ./grpc-telegram-bot/nginx | |
dockerfile: ./grpc-telegram-bot/nginx/Dockerfile | |
tags: nginx | |
push: ${{ github.event_name == 'push' }} | |
deploy: | |
if: ${{ github.event_name == 'push' }} | |
needs: [ solar-system-info-server-image, solar-system-info-bot-image, nginx-image ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup gcloud CLI | |
uses: google-github-actions/setup-gcloud@master | |
with: | |
service_account_key: ${{ secrets.GCE_SA_KEY }} | |
project_id: ${{ secrets.GCE_PROJECT }} | |
- run: | | |
sed -i 's/<paste_token_of_your_bot_here>/${{ secrets.TELOXIDE_TOKEN }}/g' ./grpc-telegram-bot/.env | |
- run: |- | |
gcloud config set compute/zone ${{ secrets.GCE_INSTANCE_ZONE }} | |
- run: |- | |
gcloud compute ssh ${{ secrets.GCE_INSTANCE }} --command 'mkdir -p ~/solar-system-info' | |
- run: |- | |
gcloud compute scp --quiet ./grpc-telegram-bot/docker-compose.yml ./grpc-telegram-bot/.env ./.github/deploy-grpc-telegram-bot.sh ${{ secrets.GCE_INSTANCE }}:~/solar-system-info/ | |
- run: |- | |
gcloud compute ssh ${{ secrets.GCE_INSTANCE }} --command 'bash ~/solar-system-info/deploy-grpc-telegram-bot.sh' |