From 51e6ac55579e1c98649ec3e77c8ab936d0517bea Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Tue, 2 Sep 2025 21:16:02 -0400 Subject: [PATCH] Bump to Node 24 and remove deprecated fields --- .github/actionlint.yml | 5 ++ .github/workflows/cleanup.yml | 8 +-- .github/workflows/integration.yml | 16 ++---- README.md | 12 ++-- action.yml | 95 +++++++++++++++---------------- package-lock.json | 56 +++++++++--------- package.json | 30 +++++----- src/main.ts | 20 ++----- tests/{ => e2e}/e2e.test.ts | 0 tests/fixtures/env_vars.txt | 2 - 10 files changed, 111 insertions(+), 133 deletions(-) create mode 100644 .github/actionlint.yml rename tests/{ => e2e}/e2e.test.ts (100%) delete mode 100644 tests/fixtures/env_vars.txt diff --git a/.github/actionlint.yml b/.github/actionlint.yml new file mode 100644 index 00000000..e70bf189 --- /dev/null +++ b/.github/actionlint.yml @@ -0,0 +1,5 @@ +paths: + '**/*.yml': + ignore: + # https://github.com/rhysd/actionlint/issues/559 + - 'invalid runner name "node24"' diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index 2a18c24b..f788cd7d 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -2,15 +2,9 @@ name: 'Cleanup' on: pull_request: - branches: - - 'main' - - 'release/**' paths: - '.github/workflows/cleanup.yml' push: - branches: - - 'main' - - 'release/**' paths: - '.github/workflows/cleanup.yml' schedule: @@ -35,7 +29,7 @@ jobs: steps: - uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' # ratchet:actions/checkout@v4 - - uses: 'google-github-actions/auth@v2' # ratchet:exclude + - uses: 'google-github-actions/auth@v3' # ratchet:exclude with: workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}' service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index e1f2f8d7..6968334b 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -54,7 +54,7 @@ jobs: - run: 'npm ci && npm run build' - - uses: 'google-github-actions/auth@v2' # ratchet:exclude + - uses: 'google-github-actions/auth@v3' # ratchet:exclude with: workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}' service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' @@ -69,7 +69,6 @@ jobs: env_vars: |- FOO=bar ZIP=zap\,with|separators\,and&stuff - env_vars_file: './tests/fixtures/env_vars.txt' secrets: |- MY_SECRET=${{ vars.SECRET_NAME }}:latest MY_SECOND_SECRET=${{ vars.SECRET_NAME }}:1 @@ -87,9 +86,7 @@ jobs: ENV: |- { "FOO": "bar", - "ZIP": "zap,with|separators,and&stuff", - "TEXT_FOO": "bar", - "TEXT_ZIP": "zap,with|separators,and&stuff" + "ZIP": "zap,with|separators,and&stuff" } SECRET_ENV: |- { @@ -173,7 +170,7 @@ jobs: - run: 'npm ci && npm run build' - - uses: 'google-github-actions/auth@v2' # ratchet:exclude + - uses: 'google-github-actions/auth@v3' # ratchet:exclude with: workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}' service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' @@ -246,7 +243,7 @@ jobs: - run: 'npm ci && npm run build' - - uses: 'google-github-actions/auth@v2' # ratchet:exclude + - uses: 'google-github-actions/auth@v3' # ratchet:exclude with: workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}' service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' @@ -260,7 +257,6 @@ jobs: env_vars: |- FOO=bar ZIP=zap\,with|separators\,and&stuff - env_vars_file: './tests/fixtures/env_vars.txt' secrets: |- MY_SECRET=${{ vars.SECRET_NAME }}:latest MY_SECOND_SECRET=${{ vars.SECRET_NAME }}:1 @@ -278,9 +274,7 @@ jobs: ENV: |- { "FOO": "bar", - "ZIP": "zap,with|separators,and&stuff", - "TEXT_FOO": "bar", - "TEXT_ZIP": "zap,with|separators,and&stuff" + "ZIP": "zap,with|separators,and&stuff" } SECRET_ENV: |- { diff --git a/README.md b/README.md index 7c253a6c..deaeeafe 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ support](https://cloud.google.com/support).** the secrets being requested. See [Authorization](#authorization) for more information. -- This action runs using Node 20. If you are using self-hosted GitHub Actions +- This action runs using Node 24. If you are using self-hosted GitHub Actions runners, you must use a [runner version](https://github.com/actions/virtual-environments) that supports this version or newer. @@ -36,13 +36,13 @@ jobs: steps: - uses: 'actions/checkout@v4' - - uses: 'google-github-actions/auth@v2' + - uses: 'google-github-actions/auth@v3' with: workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider' service_account: 'my-service-account@my-project.iam.gserviceaccount.com' - id: 'deploy' - uses: 'google-github-actions/deploy-cloudrun@v2' + uses: 'google-github-actions/deploy-cloudrun@v3' with: service: 'hello-cloud-run' image: 'us-docker.pkg.dev/cloudrun/container/hello:latest' @@ -358,12 +358,12 @@ jobs: # ... - - uses: 'google-github-actions/auth@v2' + - uses: 'google-github-actions/auth@v3' with: workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider' service_account: 'my-service-account@my-project.iam.gserviceaccount.com' - - uses: 'google-github-actions/deploy-cloudrun@v2' + - uses: 'google-github-actions/deploy-cloudrun@v3' with: image: 'us-docker.pkg.dev/cloudrun/container/hello:latest' service: 'hello-cloud-run' @@ -382,7 +382,7 @@ jobs: steps: # ... - - uses: 'google-github-actions/deploy-cloudrun@v2' + - uses: 'google-github-actions/deploy-cloudrun@v3' with: image: 'us-docker.pkg.dev/cloudrun/container/hello:latest' service: 'hello-cloud-run' diff --git a/action.yml b/action.yml index b0677a1d..6379c326 100644 --- a/action.yml +++ b/action.yml @@ -74,9 +74,11 @@ inputs: `\\n`) unless quoted. Any leading or trailing whitespace is trimmed unless values are quoted. - env_vars: |- - FRUIT=apple - SENTENCE=" this will retain leading and trailing spaces " + ```yaml + env_vars: |- + FRUIT=apple + SENTENCE=" this will retain leading and trailing spaces " + ``` This value will only be set if the input is a non-empty value. If a non-empty value is given, the field values will be overwritten (not @@ -86,27 +88,6 @@ inputs: `env_vars` will take precedence over the keys in `env_vars_file`. required: false - env_vars_file: - description: |- - Path to a file on disk, relative to the workspace, that defines - environment variables. The file can be newline-separated KEY=VALUE pairs, - JSON, or YAML format. If both `env_vars` and `env_vars_file` are - specified, the keys in env_vars will take precedence over the keys in - env_vars_file. - - NAME=person - EMAILS=foo@bar.com\,zip@zap.com - - When specified as KEY=VALUE pairs, the same escaping rules apply as - described in `env_vars`. You do not have to escape YAML or JSON. - - If both `env_vars` and `env_vars_file` are specified, the keys in - `env_vars` will take precedence over the keys in `env_vars_file`. - - **⚠️ DEPRECATION NOTICE:** This input is deprecated and will be removed in - the next major version release. - required: false - env_vars_update_strategy: description: |- Controls how the environment variables are set on the Cloud Run service. @@ -128,13 +109,15 @@ inputs: volumes. Keys starting with a forward slash '/' are mount paths. All other keys correspond to environment variables: - with: - secrets: |- - # As an environment variable: - KEY1=secret-key-1:latest + ```yaml + with: + secrets: |- + # As an environment variable: + KEY1=secret-key-1:latest - # As a volume mount: - /secrets/api/key=secret-key-2:latest + # As a volume mount: + /secrets/api/key=secret-key-2:latest + ``` This value will only be set if the input is a non-empty value. If a non-empty value is given, the field values will be overwritten (not @@ -159,9 +142,11 @@ inputs: unless quoted. Any leading or trailing whitespace is trimmed unless values are quoted. - labels: |- - labela=my-label - labelb=my-other-label + ```yaml + labels: |- + labela=my-label + labelb=my-other-label + ``` This value will only be set if the input is a non-empty value. If a non-empty value is given, the field values will be overwritten (not @@ -204,14 +189,18 @@ inputs: `gcloud run deploy`. For Cloud Run jobs, this command will be `gcloud jobs deploy`. - with: - flags: '--add-cloudsql-instances=...' + ```yaml + with: + flags: '--add-cloudsql-instances=...' + ``` Flags that include other flags must quote the _entire_ outer flag value. For example, to pass `--args=-X=123`: - with: - flags: '--add-cloudsql-instances=... "--args=-X=123"' + ```yaml + with: + flags: '--add-cloudsql-instances=... "--args=-X=123"' + ``` See the [complete list of flags](https://cloud.google.com/sdk/gcloud/reference/run/deploy#FLAGS) for @@ -240,13 +229,17 @@ inputs: description: |- Comma-separated list of revision traffic assignments. - with: - revision_traffic: 'my-revision=10' # percentage + ```yaml + with: + revision_traffic: 'my-revision=10' # percentage + ``` To update traffic to the latest revision, use the special tag "LATEST": - with: - revision_traffic: 'LATEST=100' + ```yaml + with: + revision_traffic: 'LATEST=100' + ``` This is mutually-exclusive with `tag_traffic`. This option only applies to services. @@ -256,8 +249,10 @@ inputs: description: |- Comma-separated list of tag traffic assignments. - with: - tag_traffic: 'my-tag=10' # percentage + ```yaml + with: + tag_traffic: 'my-tag=10' # percentage + ``` This is mutually-exclusive with `revision_traffic`. This option only applies to services. @@ -270,14 +265,18 @@ inputs: features that are not exposed via this GitHub Action. This flag only applies when `revision_traffic` or `tag_traffic` is set. - with: - traffic_flags: '--set-tags=...' + ```yaml + with: + traffic_flags: '--set-tags=...' + ``` Flags that include other flags must quote the _entire_ outer flag value. For example, to pass `--args=-X=123`: - with: - flags: '--set-tags=... "--args=-X=123"' + ```yaml + with: + flags: '--set-tags=... "--args=-X=123"' + ``` See the [complete list of flags](https://cloud.google.com/sdk/gcloud/reference/run/services/update#FLAGS) @@ -321,5 +320,5 @@ branding: color: 'blue' runs: - using: 'node20' + using: 'node24' main: 'dist/main/index.js' diff --git a/package-lock.json b/package-lock.json index 97c0a6c4..4c70ef49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,28 +12,28 @@ "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", "@actions/tool-cache": "^2.0.2", - "@google-github-actions/actions-utils": "^0.8.10", - "@google-github-actions/setup-cloud-sdk": "^1.2.3", - "yaml": "^2.8.0" + "@google-github-actions/actions-utils": "^1.0.1", + "@google-github-actions/setup-cloud-sdk": "^2.0.0", + "yaml": "^2.8.1" }, "devDependencies": { "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "^9.31.0", - "@types/node": "^24.0.14", - "@typescript-eslint/eslint-plugin": "^8.37.0", - "@typescript-eslint/parser": "^8.37.0", + "@eslint/js": "^9.34.0", + "@types/node": "^24.3.0", + "@typescript-eslint/eslint-plugin": "^8.42.0", + "@typescript-eslint/parser": "^8.42.0", "@vercel/ncc": "^0.38.3", - "eslint": "^9.31.0", + "eslint": "^9.34.0", "eslint-config-prettier": "^10.1.8", - "eslint-plugin-prettier": "^5.5.3", - "googleapis": "^153.0.0", + "eslint-plugin-prettier": "^5.5.4", + "googleapis": "^159.0.0", "prettier": "^3.6.2", "ts-node": "^10.9.2", - "typescript": "^5.8.3", - "typescript-eslint": "^8.37.0" + "typescript": "^5.9.2", + "typescript-eslint": "^8.42.0" }, "engines": { - "node": ">= 20.x", + "node": ">= 24.x", "npm": ">= 11.x" } }, @@ -236,9 +236,9 @@ } }, "node_modules/@google-github-actions/actions-utils": { - "version": "0.8.10", - "resolved": "https://registry.npmjs.org/@google-github-actions/actions-utils/-/actions-utils-0.8.10.tgz", - "integrity": "sha512-NLmKwQgPj0cQyDjbtQIGUYBdPtFIywLbH10RPRuhF6tO7qlO19N76SsaDEiZ7iKlXA9Yfj8TS3lK6wfdJyE+hw==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@google-github-actions/actions-utils/-/actions-utils-1.0.1.tgz", + "integrity": "sha512-dEvNcy63a6pkcMsRhWbfjNePsv4kR61O56mQ9rVXvRgjAvRkZTBiM1G7QSnHulMEjhLIlTEGlBIKEKIxCoonkQ==", "license": "Apache-2.0", "dependencies": { "yaml": "^2.8.1" @@ -247,26 +247,26 @@ "actions-gen-readme": "bin/actions-gen-readme.mjs" }, "engines": { - "node": ">= 20.x", - "npm": ">= 10.x" + "node": ">= 24.x", + "npm": ">= 11.x" } }, "node_modules/@google-github-actions/setup-cloud-sdk": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@google-github-actions/setup-cloud-sdk/-/setup-cloud-sdk-1.2.3.tgz", - "integrity": "sha512-6k+yIVvxqkp21LMaxytVvIrnyvvLBH5ezKePkIxoFBvcKIOTTpf7L5B5KlMBUHzyjTsNIohtu5iHg+AEBAD8ug==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@google-github-actions/setup-cloud-sdk/-/setup-cloud-sdk-2.0.0.tgz", + "integrity": "sha512-ZrfolwXPE3C2kzyunxeb77TtUQv765aIG2LD7lGXtA9q4WRBoo5xj1I1Mu9d/od2tKvhFh2RwSiRxdBvZMcfxQ==", "license": "Apache-2.0", "dependencies": { "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", "@actions/http-client": "^2.2.3", "@actions/tool-cache": "^2.0.2", - "@google-github-actions/actions-utils": "^0.8.10", + "@google-github-actions/actions-utils": "^1.0.1", "semver": "^7.7.2" }, "engines": { - "node": ">= 20.x", - "npm": ">= 10.x" + "node": ">= 24.x", + "npm": ">= 11.x" } }, "node_modules/@google-github-actions/setup-cloud-sdk/node_modules/semver": { @@ -1696,13 +1696,13 @@ } }, "node_modules/googleapis": { - "version": "153.0.0", - "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-153.0.0.tgz", - "integrity": "sha512-QT9Tdy9lx7KuZx620RaR/YsjwZTSw/dqlPKQRVLnMKTzOEghN0uZaKvpsm8aXjK+yEKWhJ8HQ6qOXRsJPLZHpw==", + "version": "159.0.0", + "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-159.0.0.tgz", + "integrity": "sha512-halby2+lQwHNxUDk70aQNXP1BlBwdwr7svTJZvDi7vKwrWbVMKhVrZ86h8p3zRcWbO4qAgLQ4ODAf8TgD3DhGQ==", "dev": true, "license": "Apache-2.0", "dependencies": { - "google-auth-library": "^10.1.0", + "google-auth-library": "^10.2.0", "googleapis-common": "^8.0.0" }, "engines": { diff --git a/package.json b/package.json index 08040ea5..57abe18c 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,11 @@ "docs": "./node_modules/.bin/actions-gen-readme", "lint": "eslint .", "format": "eslint . --fix", - "test": "node --require ts-node/register --test-reporter spec --test tests/unit/main.test.ts tests/unit/output-parser.test.ts", - "e2e-tests": "node --require ts-node/register --test-reporter spec --test tests/e2e.test.ts" + "test": "node --require ts-node/register --test-reporter spec --test tests/unit/**/*.test.ts", + "e2e-tests": "node --require ts-node/register --test-reporter spec --test tests/e2e/**/*.test.ts" }, "engines": { - "node": ">= 20.x", + "node": ">= 24.x", "npm": ">= 11.x" }, "repository": { @@ -37,24 +37,24 @@ "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", "@actions/tool-cache": "^2.0.2", - "@google-github-actions/actions-utils": "^0.8.10", - "@google-github-actions/setup-cloud-sdk": "^1.2.3", - "yaml": "^2.8.0" + "@google-github-actions/actions-utils": "^1.0.1", + "@google-github-actions/setup-cloud-sdk": "^2.0.0", + "yaml": "^2.8.1" }, "devDependencies": { "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "^9.31.0", - "@types/node": "^24.0.14", - "@typescript-eslint/eslint-plugin": "^8.37.0", - "@typescript-eslint/parser": "^8.37.0", + "@eslint/js": "^9.34.0", + "@types/node": "^24.3.0", + "@typescript-eslint/eslint-plugin": "^8.42.0", + "@typescript-eslint/parser": "^8.42.0", "@vercel/ncc": "^0.38.3", "eslint-config-prettier": "^10.1.8", - "eslint-plugin-prettier": "^5.5.3", - "eslint": "^9.31.0", - "googleapis": "^153.0.0", + "eslint-plugin-prettier": "^5.5.4", + "eslint": "^9.34.0", + "googleapis": "^159.0.0", "prettier": "^3.6.2", "ts-node": "^10.9.2", - "typescript-eslint": "^8.37.0", - "typescript": "^5.8.3" + "typescript-eslint": "^8.42.0", + "typescript": "^5.9.2" } } diff --git a/src/main.ts b/src/main.ts index fedeec3a..e53f4382 100644 --- a/src/main.ts +++ b/src/main.ts @@ -103,7 +103,6 @@ export async function run(): Promise { const gcloudVersion = await computeGcloudVersion(getInput('gcloud_version')); const gcloudComponent = presence(getInput('gcloud_component')); // Cloud SDK component version const envVars = getInput('env_vars'); // String of env vars KEY=VALUE,... - const envVarsFile = getInput('env_vars_file'); // File that is a string of env vars KEY=VALUE,... const envVarsUpdateStrategy = getInput('env_vars_update_strategy') || 'merge'; const secrets = parseKVString(getInput('secrets')); // String of secrets KEY=VALUE,... const secretsUpdateStrategy = getInput('secrets_update_strategy') || 'merge'; @@ -137,17 +136,6 @@ export async function run(): Promise { throw new Error('Only one of `service` or `job` inputs can be set.'); } - // Deprecation notices - if (envVarsFile) { - logWarning( - `The "env_vars_file" input is deprecated and will be removed in a ` + - `future major release. To source values from a file, read the file ` + - `in a separate GitHub Actions step and set the contents as an output. ` + - `Alternatively, there are many community actions that automate ` + - `reading files.`, - ); - } - // Validate gcloud component input if (gcloudComponent && gcloudComponent !== 'alpha' && gcloudComponent !== 'beta') { throw new Error(`invalid input received for gcloud_component: ${gcloudComponent}`); @@ -194,7 +182,7 @@ export async function run(): Promise { } // Set optional flags from inputs - setEnvVarsFlags(deployCmd, envVars, envVarsFile, envVarsUpdateStrategy); + setEnvVarsFlags(deployCmd, envVars, envVarsUpdateStrategy); setSecretsFlags(deployCmd, secrets, secretsUpdateStrategy); if (wait) { @@ -228,7 +216,7 @@ export async function run(): Promise { } // Set optional flags from inputs - setEnvVarsFlags(deployCmd, envVars, envVarsFile, envVarsUpdateStrategy); + setEnvVarsFlags(deployCmd, envVars, envVarsUpdateStrategy); setSecretsFlags(deployCmd, secrets, secretsUpdateStrategy); if (tag) { @@ -385,8 +373,8 @@ async function computeGcloudVersion(str: string): Promise { return str; } -function setEnvVarsFlags(cmd: string[], envVars: string, envVarsFile: string, strategy: string) { - const compiledEnvVars = parseKVStringAndFile(envVars, envVarsFile); +function setEnvVarsFlags(cmd: string[], envVars: string, strategy: string) { + const compiledEnvVars = parseKVString(envVars); if (compiledEnvVars && Object.keys(compiledEnvVars).length > 0) { let flag = ''; if (strategy === 'overwrite') { diff --git a/tests/e2e.test.ts b/tests/e2e/e2e.test.ts similarity index 100% rename from tests/e2e.test.ts rename to tests/e2e/e2e.test.ts diff --git a/tests/fixtures/env_vars.txt b/tests/fixtures/env_vars.txt deleted file mode 100644 index 9d180897..00000000 --- a/tests/fixtures/env_vars.txt +++ /dev/null @@ -1,2 +0,0 @@ -TEXT_FOO=bar -TEXT_ZIP=zap\,with|separators\,and&stuff