mirror of
https://github.com/google-github-actions/setup-gcloud.git
synced 2026-08-22 08:59:21 +00:00
Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01af06c41d | ||
|
|
aa5489c893 | ||
|
|
26f734c277 | ||
|
|
d26df95ce1 | ||
|
|
f7c29183d6 | ||
|
|
6387e69544 |
8 changed files with 67 additions and 64 deletions
5
.github/actionlint.yml
vendored
Normal file
5
.github/actionlint.yml
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
paths:
|
||||
'**/*.yml':
|
||||
ignore:
|
||||
# https://github.com/rhysd/actionlint/issues/559
|
||||
- 'invalid runner name "node24"'
|
||||
10
.github/workflows/integration.yml
vendored
10
.github/workflows/integration.yml
vendored
|
|
@ -46,28 +46,24 @@ 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'
|
||||
|
|
@ -81,7 +77,6 @@ jobs:
|
|||
uses: './'
|
||||
with:
|
||||
install_components: 'cloud-run-proxy'
|
||||
skip_tool_cache: true
|
||||
|
||||
- name: 'Check components'
|
||||
run: 'npm run integration'
|
||||
|
|
@ -93,7 +88,6 @@ jobs:
|
|||
uses: './'
|
||||
with:
|
||||
project_id: '${{ vars.PROJECT_ID }}'
|
||||
skip_tool_cache: true
|
||||
|
||||
- name: 'Check project ID'
|
||||
run: 'npm run integration'
|
||||
|
|
@ -109,8 +103,6 @@ jobs:
|
|||
|
||||
- name: 'Setup gcloud with WIF'
|
||||
uses: './'
|
||||
with:
|
||||
skip_tool_cache: true
|
||||
|
||||
- name: 'Check WIF authentication'
|
||||
run: 'npm run integration'
|
||||
|
|
@ -126,8 +118,6 @@ jobs:
|
|||
|
||||
- name: 'Setup gcloud with SAKE'
|
||||
uses: './'
|
||||
with:
|
||||
skip_tool_cache: true
|
||||
|
||||
- name: 'Check SAKE authentication'
|
||||
run: 'npm run integration'
|
||||
|
|
|
|||
39
README.md
39
README.md
|
|
@ -1,7 +1,6 @@
|
|||
# `setup-gcloud` GitHub Action
|
||||
|
||||
Configures the [Google Cloud SDK][sdk] in the GitHub Actions environment. The Google Cloud SDK includes both the [gcloud][gcloud] and
|
||||
[gsutil][gsutil] binaries.
|
||||
Configures the [Google Cloud SDK][sdk] in the GitHub Actions environment. The Google Cloud SDK includes the [gcloud][gcloud] binary.
|
||||
|
||||
Or integrate natively with other Google Cloud GitHub Actions:
|
||||
|
||||
|
|
@ -23,7 +22,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 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.
|
||||
|
|
@ -46,7 +45,7 @@ jobs:
|
|||
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
|
||||
|
||||
- name: 'Set up Cloud SDK'
|
||||
uses: 'google-github-actions/setup-gcloud@v2'
|
||||
uses: 'google-github-actions/setup-gcloud@v3'
|
||||
with:
|
||||
version: '>= 363.0.0'
|
||||
|
||||
|
|
@ -63,7 +62,7 @@ jobs:
|
|||
value is `"latest"`, which will always download and install the latest
|
||||
available Cloud SDK version.
|
||||
|
||||
- uses: 'google-github-actions/setup-gcloud@v2'
|
||||
- uses: 'google-github-actions/setup-gcloud@v3'
|
||||
with:
|
||||
version: '>= 416.0.0'
|
||||
|
||||
|
|
@ -76,7 +75,7 @@ jobs:
|
|||
or newer. If you need support for Workload Identity Federation, specify
|
||||
your version constraint as such:
|
||||
|
||||
- uses: 'google-github-actions/setup-gcloud@v2'
|
||||
- uses: 'google-github-actions/setup-gcloud@v3'
|
||||
with:
|
||||
version: '>= 363.0.0'
|
||||
|
||||
|
|
@ -102,13 +101,10 @@ jobs:
|
|||
⚠️ You will not be able to install additional gcloud components, because the
|
||||
system installation is locked.
|
||||
|
||||
- <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.
|
||||
- <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.
|
||||
|
||||
|
||||
<!-- END_AUTOGEN_INPUTS -->
|
||||
|
|
@ -134,7 +130,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` and `gsutil` tools.**
|
||||
`bq` tool.**
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
|
|
@ -152,7 +148,7 @@ jobs:
|
|||
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
|
||||
|
||||
- name: 'Set up Cloud SDK'
|
||||
uses: 'google-github-actions/setup-gcloud@v2'
|
||||
uses: 'google-github-actions/setup-gcloud@v3'
|
||||
|
||||
- name: 'Use gcloud CLI'
|
||||
run: 'gcloud info'
|
||||
|
|
@ -170,7 +166,7 @@ jobs:
|
|||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
|
||||
|
||||
- name: 'Set up Cloud SDK'
|
||||
uses: 'google-github-actions/setup-gcloud@v2'
|
||||
uses: 'google-github-actions/setup-gcloud@v3'
|
||||
|
||||
- name: 'Use gcloud CLI'
|
||||
run: 'gcloud info'
|
||||
|
|
@ -187,7 +183,7 @@ jobs:
|
|||
job_id:
|
||||
steps:
|
||||
- name: 'Set up Cloud SDK'
|
||||
uses: 'google-github-actions/setup-gcloud@v2'
|
||||
uses: 'google-github-actions/setup-gcloud@v3'
|
||||
|
||||
- name: 'Use gcloud CLI'
|
||||
run: 'gcloud info'
|
||||
|
|
@ -213,7 +209,7 @@ jobs:
|
|||
service_account: 'service-account-1@my-project.iam.gserviceaccount.com'
|
||||
|
||||
- name: 'Set up Cloud SDK'
|
||||
uses: 'google-github-actions/setup-gcloud@v2'
|
||||
uses: 'google-github-actions/setup-gcloud@v3'
|
||||
|
||||
- name: 'Use gcloud CLI'
|
||||
run: 'gcloud auth list --filter=status:ACTIVE --format="value(account)"'
|
||||
|
|
@ -225,7 +221,7 @@ jobs:
|
|||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
|
||||
|
||||
- name: 'Set up Cloud SDK'
|
||||
uses: 'google-github-actions/setup-gcloud@v2'
|
||||
uses: 'google-github-actions/setup-gcloud@v3'
|
||||
|
||||
- name: 'Use gcloud CLI'
|
||||
run: 'gcloud auth list --filter=status:ACTIVE --format="value(account)"'
|
||||
|
|
@ -238,7 +234,7 @@ jobs:
|
|||
We recommend pinning to the latest available major version:
|
||||
|
||||
```yaml
|
||||
- uses: 'google-github-actions/setup-gcloud@v2'
|
||||
- uses: 'google-github-actions/setup-gcloud@v3'
|
||||
```
|
||||
|
||||
While this action attempts to follow semantic versioning, but we're ultimately
|
||||
|
|
@ -246,7 +242,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@v2.0.0'
|
||||
- uses: 'google-github-actions/setup-gcloud@v3.0.0'
|
||||
```
|
||||
|
||||
However, you will not get automatic security updates or new features without
|
||||
|
|
@ -261,7 +257,6 @@ 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
|
||||
|
|
|
|||
19
action.yml
19
action.yml
|
|
@ -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@v2'
|
||||
- uses: 'google-github-actions/setup-gcloud@v3'
|
||||
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@v2'
|
||||
- uses: 'google-github-actions/setup-gcloud@v3'
|
||||
with:
|
||||
version: '>= 363.0.0'
|
||||
|
||||
|
|
@ -77,15 +77,12 @@ inputs:
|
|||
default: false
|
||||
required: false
|
||||
|
||||
skip_tool_cache:
|
||||
cache:
|
||||
description: |-
|
||||
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.
|
||||
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.
|
||||
default: false
|
||||
required: false
|
||||
|
||||
|
|
@ -99,5 +96,5 @@ branding:
|
|||
color: 'blue'
|
||||
|
||||
runs:
|
||||
using: 'node20'
|
||||
using: 'node24'
|
||||
main: 'dist/index.js'
|
||||
|
|
|
|||
6
dist/index.js
vendored
6
dist/index.js
vendored
File diff suppressed because one or more lines are too long
38
package-lock.json
generated
38
package-lock.json
generated
|
|
@ -1,18 +1,18 @@
|
|||
{
|
||||
"name": "setup-gcloud",
|
||||
"version": "2.2.1",
|
||||
"version": "3.0.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "setup-gcloud",
|
||||
"version": "2.2.1",
|
||||
"version": "3.0.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": "^1.2.3"
|
||||
"@google-github-actions/setup-cloud-sdk": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
|
|
@ -30,8 +30,8 @@
|
|||
"typescript-eslint": "^8.40.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20.x",
|
||||
"npm": ">= 10.x"
|
||||
"node": ">= 24.x",
|
||||
"npm": ">= 11.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core": {
|
||||
|
|
@ -249,21 +249,37 @@
|
|||
}
|
||||
},
|
||||
"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/@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_modules/@google-github-actions/setup-cloud-sdk/node_modules/semver": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "setup-gcloud",
|
||||
"version": "2.2.1",
|
||||
"version": "3.0.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": ">= 20.x",
|
||||
"npm": ">= 10.x"
|
||||
"node": ">= 24.x",
|
||||
"npm": ">= 11.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": "^1.2.3"
|
||||
"@google-github-actions/setup-cloud-sdk": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export async function run(): Promise<void> {
|
|||
|
||||
// Warn if pinned to HEAD
|
||||
if (isPinnedToHead()) {
|
||||
core.warning(pinnedToHeadWarning('v2'));
|
||||
core.warning(pinnedToHeadWarning('v3'));
|
||||
}
|
||||
|
||||
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 skipToolCache = parseBoolean(core.getInput('skip_tool_cache'));
|
||||
const cache = parseBoolean(core.getInput('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, skipToolCache);
|
||||
await installGcloudSDK(version, cache);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue