Merge pull request #16 from jaimegarjr/add-gcplogs #3
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: Main Deploy Pipeline | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
main-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "export PATH=\$HOME/.local/bin:\$PATH" >> $GITHUB_ENV | |
- name: Install dependencies and export requirements.txt | |
run: | | |
poetry install | |
poetry export --without-hashes -f requirements.txt -o requirements.txt | |
- name: Log in to Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Configure Docker | |
run: gcloud auth configure-docker | |
- name: Build and Push Docker Image | |
run: | | |
docker build -t gcr.io/meowbot-448505/meow-bot:latest . | |
docker push gcr.io/meowbot-448505/meow-bot:latest | |
- name: Deploy to VM | |
run: | | |
gcloud compute instances update-container meowbot-instance-vm \ | |
--container-image gcr.io/meowbot-448505/meow-bot:latest \ | |
--zone us-central1-c \ | |
--container-arg="--log-driver=gcplogs" |