google-github-actions / setup-gcloud

A GitHub Action for installing and configuring the gcloud CLI.
https://cloud.google.com/sdk/docs
Apache License 2.0
1.71k stars 510 forks source link

Can't find 'action.yml', 'action.yaml' or 'Dockerfile' for action 'GoogleCloudPlatform/github-actions/setup-gcloud@main'. #675

Closed basit511 closed 3 weeks ago

basit511 commented 8 months ago

TL;DR

Deploying a Docker Image to GCP - GCR

Expected behavior

No response

Observed behavior

No response

Action YAML

#Deploy.yml
name: Deploy to GKE

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout Repository
      uses: actions/checkout@v2

    - name: Set up Google Cloud SDK
      uses: GoogleCloudPlatform/github-actions/setup-gcloud@main
      with:
        project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
        service_account_key: ${{ secrets.GCLOUD_KEY }}
        export_default_credentials: true

    - name: Build Docker Image
      run: |
        docker build -t gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/hello.py:${{ github.sha }} .
        docker push gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/hello.py:${{ github.sha }}

    - name: Configure kubectl
      run: |
        gcloud container clusters get-credentials ${{ secrets.GCLOUD_CLUSTER_NAME }} --zone ${{ secrets.GCLOUD_ZONE }}

    - name: Deploy to GKE
      run: |
        kubectl set image deployment/hello.py-deployment hello.py=gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/hello.py:${{ github.sha }}

Log output

Current runner version: '2.311.0'
Operating System
Runner Image
Runner Image Provisioner
GITHUB_TOKEN Permissions
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v2' (SHA:ee0669bd1cc54295c223e0bb666b733df41de1c5)
Download action repository 'GoogleCloudPlatform/github-actions@main' (SHA:5a5f7b85fca43e76e53463acaa9d408a03c98d3a)
Error: Can't find 'action.yml', 'action.yaml' or 'Dockerfile' for action 'GoogleCloudPlatform/github-actions/setup-gcloud@main'.

Additional information

No response

sethvargo commented 8 months ago

Hi @basit511 - that's because GoogleCloudPlatform/github-actions/setup-gcloud@main does not exist. The GitHub action is google-github-actions/setup-gcloud@v2. Where did you find GoogleCloudPlatform/github-actions/setup-gcloud@main?

muradkhan995 commented 3 weeks ago

Verify Action Repository and Version

Updated Action Configuration

- name: Set up Google Cloud SDK
  uses: google-github-actions/setup-gcloud@v1
  with:
    project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
    service_account_key: ${{ secrets.GCLOUD_KEY }}
    export_default_credentials: true

Update Workflow YAML


name: Deploy to GKE

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout Repository
      uses: actions/checkout@v2

    - name: Set up Google Cloud SDK
      uses: google-github-actions/setup-gcloud@v1
      with:
        project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
        service_account_key: ${{ secrets.GCLOUD_KEY }}
        export_default_credentials: true

    - name: Build Docker Image
      run: |
        docker build -t gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/hello.py:${{ github.sha }} .
        docker push gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/hello.py:${{ github.sha }}

    - name: Configure kubectl
      run: |
        gcloud container clusters get-credentials ${{ secrets.GCLOUD_CLUSTER_NAME }} --zone ${{ secrets.GCLOUD_ZONE }}

    - name: Deploy to GKE
      run: |
        kubectl set image deployment/hello.py-deployment hello.py=gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/hello.py:${{ github.sha }}