Compare commits

..

No commits in common. "main" and "v2" have entirely different histories.
main ... v2

8 changed files with 64 additions and 67 deletions

View file

@ -1,5 +0,0 @@
paths:
'**/*.yml':
ignore:
# https://github.com/rhysd/actionlint/issues/559
- 'invalid runner name "node24"'

View file

@ -46,24 +46,28 @@ jobs:
uses: './'
with:
skip_install: true
skip_tool_cache: true
# Constraint installation
- name: 'Install constraint'
uses: './'
with:
version: '>= 1.0.0'
skip_tool_cache: true
# Default installation
- name: 'Install version'
uses: './'
with:
version: '374.0.0'
skip_tool_cache: true
# Latest installation
- name: 'Install latest'
uses: './'
with:
version: 'latest'
skip_tool_cache: true
# By default, there is no configuration
- name: 'Check defaults'
@ -77,6 +81,7 @@ jobs:
uses: './'
with:
install_components: 'cloud-run-proxy'
skip_tool_cache: true
- name: 'Check components'
run: 'npm run integration'
@ -88,6 +93,7 @@ jobs:
uses: './'
with:
project_id: '${{ vars.PROJECT_ID }}'
skip_tool_cache: true
- name: 'Check project ID'
run: 'npm run integration'
@ -103,6 +109,8 @@ jobs:
- name: 'Setup gcloud with WIF'
uses: './'
with:
skip_tool_cache: true
- name: 'Check WIF authentication'
run: 'npm run integration'
@ -118,6 +126,8 @@ jobs:
- name: 'Setup gcloud with SAKE'
uses: './'
with:
skip_tool_cache: true
- name: 'Check SAKE authentication'
run: 'npm run integration'

View file

@ -1,6 +1,7 @@
# `setup-gcloud` GitHub Action
Configures the [Google Cloud SDK][sdk] in the GitHub Actions environment. The Google Cloud SDK includes the [gcloud][gcloud] binary.
Configures the [Google Cloud SDK][sdk] in the GitHub Actions environment. The Google Cloud SDK includes both the [gcloud][gcloud] and
[gsutil][gsutil] binaries.
Or integrate natively with other Google Cloud GitHub Actions:
@ -22,7 +23,7 @@ support](https://cloud.google.com/support).**
- This action requires Google Cloud credentials to execute gcloud commands.
See [Authorization](#Authorization) for more details.
- This action runs using Node 24. If you are using self-hosted GitHub Actions
- This action runs using Node 20. 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.
@ -45,7 +46,7 @@ jobs:
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v3'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
@ -62,7 +63,7 @@ jobs:
value is `"latest"`, which will always download and install the latest
available Cloud SDK version.
- uses: 'google-github-actions/setup-gcloud@v3'
- uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 416.0.0'
@ -75,7 +76,7 @@ jobs:
or newer. If you need support for Workload Identity Federation, specify
your version constraint as such:
- uses: 'google-github-actions/setup-gcloud@v3'
- uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
@ -101,10 +102,13 @@ jobs:
⚠️ You will not be able to install additional gcloud components, because the
system installation is locked.
- <a name="__input_cache"></a><a href="#user-content-__input_cache"><code>cache</code></a>: _(Optional)_ Transfer the downloaded artifacts into the runner's tool cache. On
GitHub-managed runners, this have very little impact since runneres are
ephemeral. On self-hosted runners, this could improve future runs by
skipping future gcloud installations.
- <a name="__input_skip_tool_cache"></a><a href="#user-content-__input_skip_tool_cache"><code>skip_tool_cache</code></a>: _(Optional)_ Skip transferring the downloaded artifacts into the runner's tool cache.
On GitHub-managed runners, this makes no difference since they are
ephemeral. On self-hosted runners, this controls whether the downloads are
cached stored on the disk.
For backwards-compatibility, this is is "false" by default. Setting the
value to "true" can significantly speed up installation times.
<!-- END_AUTOGEN_INPUTS -->
@ -130,7 +134,7 @@ authenticate via the following options:
### Workload Identity Federation (preferred)
**⚠️ You must use the Cloud SDK version 390.0.0 or later to authenticate the
`bq` tool.**
`bq` and `gsutil` tools.**
```yaml
jobs:
@ -148,7 +152,7 @@ jobs:
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v3'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Use gcloud CLI'
run: 'gcloud info'
@ -166,7 +170,7 @@ jobs:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v3'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Use gcloud CLI'
run: 'gcloud info'
@ -183,7 +187,7 @@ jobs:
job_id:
steps:
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v3'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Use gcloud CLI'
run: 'gcloud info'
@ -209,7 +213,7 @@ jobs:
service_account: 'service-account-1@my-project.iam.gserviceaccount.com'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v3'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Use gcloud CLI'
run: 'gcloud auth list --filter=status:ACTIVE --format="value(account)"'
@ -221,7 +225,7 @@ jobs:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v3'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Use gcloud CLI'
run: 'gcloud auth list --filter=status:ACTIVE --format="value(account)"'
@ -234,7 +238,7 @@ jobs:
We recommend pinning to the latest available major version:
```yaml
- uses: 'google-github-actions/setup-gcloud@v3'
- uses: 'google-github-actions/setup-gcloud@v2'
```
While this action attempts to follow semantic versioning, but we're ultimately
@ -242,7 +246,7 @@ human and sometimes make mistakes. To prevent accidental breaking changes, you
can also pin to a specific version:
```yaml
- uses: 'google-github-actions/setup-gcloud@v3.0.0'
- uses: 'google-github-actions/setup-gcloud@v2.0.0'
```
However, you will not get automatic security updates or new features without
@ -257,6 +261,7 @@ explicitly updating your version number. Note that we only publish `MAJOR` and
[sdk]: https://cloud.google.com/sdk/
[gcloud]: https://cloud.google.com/sdk/gcloud/
[gcloud-credentials]: https://cloud.google.com/docs/authentication/gcloud#gcloud-credentials
[gsutil]: https://cloud.google.com/storage/docs/gsutil
[sa-iam-docs]: https://cloud.google.com/iam/docs/service-accounts
[sa]: https://cloud.google.com/iam/docs/creating-managing-service-accounts
[wif]: https://cloud.google.com/iam/docs/workload-identity-federation

View file

@ -26,7 +26,7 @@ inputs:
value is `"latest"`, which will always download and install the latest
available Cloud SDK version.
- uses: 'google-github-actions/setup-gcloud@v3'
- uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 416.0.0'
@ -39,7 +39,7 @@ inputs:
or newer. If you need support for Workload Identity Federation, specify
your version constraint as such:
- uses: 'google-github-actions/setup-gcloud@v3'
- uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
@ -77,12 +77,15 @@ inputs:
default: false
required: false
cache:
skip_tool_cache:
description: |-
Transfer the downloaded artifacts into the runner's tool cache. On
GitHub-managed runners, this have very little impact since runneres are
ephemeral. On self-hosted runners, this could improve future runs by
skipping future gcloud installations.
Skip transferring the downloaded artifacts into the runner's tool cache.
On GitHub-managed runners, this makes no difference since they are
ephemeral. On self-hosted runners, this controls whether the downloads are
cached stored on the disk.
For backwards-compatibility, this is is "false" by default. Setting the
value to "true" can significantly speed up installation times.
default: false
required: false
@ -96,5 +99,5 @@ branding:
color: 'blue'
runs:
using: 'node24'
using: 'node20'
main: 'dist/index.js'

6
dist/index.js vendored

File diff suppressed because one or more lines are too long

38
package-lock.json generated
View file

@ -1,18 +1,18 @@
{
"name": "setup-gcloud",
"version": "3.0.1",
"version": "2.2.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "setup-gcloud",
"version": "3.0.1",
"version": "2.2.1",
"license": "Apache-2.0",
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/tool-cache": "^2.0.2",
"@google-github-actions/actions-utils": "^0.8.10",
"@google-github-actions/setup-cloud-sdk": "^2.0.0"
"@google-github-actions/setup-cloud-sdk": "^1.2.3"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
@ -30,8 +30,8 @@
"typescript-eslint": "^8.40.0"
},
"engines": {
"node": ">= 24.x",
"npm": ">= 11.x"
"node": ">= 20.x",
"npm": ">= 10.x"
}
},
"node_modules/@actions/core": {
@ -249,37 +249,21 @@
}
},
"node_modules/@google-github-actions/setup-cloud-sdk": {
"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==",
"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==",
"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": "^1.0.1",
"@google-github-actions/actions-utils": "^0.8.10",
"semver": "^7.7.2"
},
"engines": {
"node": ">= 24.x",
"npm": ">= 11.x"
}
},
"node_modules/@google-github-actions/setup-cloud-sdk/node_modules/@google-github-actions/actions-utils": {
"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"
},
"bin": {
"actions-gen-readme": "bin/actions-gen-readme.mjs"
},
"engines": {
"node": ">= 24.x",
"npm": ">= 11.x"
"node": ">= 20.x",
"npm": ">= 10.x"
}
},
"node_modules/@google-github-actions/setup-cloud-sdk/node_modules/semver": {

View file

@ -1,6 +1,6 @@
{
"name": "setup-gcloud",
"version": "3.0.1",
"version": "2.2.1",
"description": "Setup gcloud GitHub action",
"main": "dist/main/index.js",
"scripts": {
@ -12,8 +12,8 @@
"test": "node --require ts-node/register --test-reporter spec --test tests/setup-gcloud.test.ts"
},
"engines": {
"node": ">= 24.x",
"npm": ">= 11.x"
"node": ">= 20.x",
"npm": ">= 10.x"
},
"repository": {
"type": "git",
@ -33,7 +33,7 @@
"@actions/core": "^1.11.1",
"@actions/tool-cache": "^2.0.2",
"@google-github-actions/actions-utils": "^0.8.10",
"@google-github-actions/setup-cloud-sdk": "^2.0.0"
"@google-github-actions/setup-cloud-sdk": "^1.2.3"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",

View file

@ -48,7 +48,7 @@ export async function run(): Promise<void> {
// Warn if pinned to HEAD
if (isPinnedToHead()) {
core.warning(pinnedToHeadWarning('v3'));
core.warning(pinnedToHeadWarning('v2'));
}
try {
@ -56,7 +56,7 @@ export async function run(): Promise<void> {
let version = presence(core.getInput('version'));
const components = core.getInput('install_components');
const projectId = core.getInput('project_id');
const cache = parseBoolean(core.getInput('cache'));
const skipToolCache = parseBoolean(core.getInput('skip_tool_cache'));
if (skipInstall) {
core.info(`Skipping installation ("skip_install" was true)`);
@ -91,7 +91,7 @@ export async function run(): Promise<void> {
core.addPath(path.join(toolPath, 'bin'));
} else {
core.debug(`no version of gcloud matching "${version}" is installed`);
await installGcloudSDK(version, cache);
await installGcloudSDK(version, skipToolCache);
}
}