Issue in automating the deployment of Compute Server Image onto GCE via GitHub Actions Workflow

Hi all,

I have been trying to automate the process of packer GCE build image through the GitHub workflow actions and I am encountering the below error:

—ERROR—
Run packer validate build-img-packer.json
googlecompute: output will be in this color.

==> googlecompute: Checking image does not exist…
==> googlecompute: Creating temporary rsa SSH key for instance…
==> googlecompute: Error getting source image for instance creation: Could not find image, ubuntu-minimal-2004-lts, in projects, [*** centos-cloud cos-cloud coreos-cloud debian-cloud rhel-cloud rhel-sap-cloud suse-cloud suse-sap-cloud suse-byos-cloud ubuntu-os-cloud windows-cloud windows-sql-cloud gce-nvme google-containers opensuse-cloud]: 16 error(s) occurred:
==> googlecompute:
==> googlecompute: * Get “https://compute.googleapis.com/compute/v1/projects/***/global/images/family/ubuntu-minimal-2004-lts?alt=json&prettyPrint=false”: oauth2: cannot fetch token: 400 Bad Request
==> googlecompute: Response: “error”:“invalid_grant”,“error_description”:“Invalid grant: account not found”
==> googlecompute: * Get “https://compute.googleapis.com/compute/v1/projects/centos-cloud/global/images/family/ubuntu-minimal-2004-lts?alt=json&prettyPrint=false”: oauth2: cannot fetch token: 400 Bad Request
==> googlecompute: Response: “error”:“invalid_grant”,“error_description”:“Invalid grant: account not found”

Here are the steps which I have performed from my side -

Created a service account for the packer and added the roles - Compute instance Admin and Service Account User. Generated a service account key in JSON format and updated the key in the secrets part of GitHub.
Created a package.json file that contains all the required fields for the builders and provisioners. In the account_file field of builders I had given the JSON key.

Wrote a workflow file for the packer. Below is the configuration step that I have used.
jobs:
packer:
name: build image
runs-on: ubuntu-latest
steps:

name: Checkout
uses: actions/checkout@v2

uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: ‘270.0.0’
service_account_key: {{ secrets.PACKAGE_SERVICE_ACCOUNT_KEY }} project_id: {{ secrets.PROJECT_ID }}
service_account_email: ${{ secrets.GCP_SV_ACCOUNT_EMAIL }}

name: Build packer image
run: |-
packer validate build-img-packer.json
packer build -force build-img-packer.json

Given below is my build-img-packer.json file

{
“builders”: [
{
“type”: “googlecompute”,
“account_file”: "* ",
“project_id”: "
",
“source_image_family”: “ubuntu-minimal-2004-lts”,
“ssh_username”: “packer”,
“zone”: “asia-south1-a”,
“image_description”: “Custom Ubuntu Machine Image”,
“image_name”: “compute-server-image-jupyter-20”,
“machine_type”: “n1-standard-1”,
“disk_size”: 20,
“disk_type”: “pd-ssd”
}
],
“provisioners”: [
{
“type”: “shell”,
“script”: “./setup.sh”
}
]

I am getting the above-mentioned error on triggering the workflow. I would like to understand if there is an authentication step to be added before the packer build as the error states account not found.

My expected action is to deploy the compute server image with the help of packers onto GCE from the workflow.
I would appreciate it if there is any right documentation or steps that will help me to arrive at the desired result.

Thank you in advance!