removed conflicting actions #43
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: Docker | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
deploy: | |
name: Run CI/CD pipeline | |
runs-on: ubuntu-latest | |
env: | |
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }} | |
steps: | |
- name: Login | |
uses: google-github-actions/setup-gcloud@v0 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
service_account_email: ${{ secrets.GCP_EMAIL }} | |
service_account_key: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Configure Docker | |
run: gcloud auth configure-docker --quiet | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Build Docker image | |
run: docker build . -t $IMAGE_NAME | |
#- name: Run Unittests on Docker image | |
# run: docker run --rm $IMAGE_NAME python tests.py | |
- name: Push Docker image | |
run: docker push $IMAGE_NAME | |
- name: Set service name | |
run: | | |
SERVICE_NAME=$(echo "${{ github.repository }}" | tr / - | tr '[:upper:]' '[:lower:]') | |
echo "SERVICE_NAME=$SERVICE_NAME" >> $GITHUB_ENV | |
- name: Deploy Docker image | |
run: gcloud run deploy $SERVICE_NAME --image $IMAGE_NAME --region us-central1 --platform managed |