Skip to content

Commit e3f4304

Browse files
authored
Enable auto-publish and update dependencies (#248)
Review with whitespace diffing off for an easier time. https://github.com/google-github-actions/setup-cloud-sdk/pull/248/files?w=1
1 parent 780e1c9 commit e3f4304

7 files changed

Lines changed: 219 additions & 230 deletions

File tree

.github/workflows/compile-versions.yml

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -17,80 +17,80 @@ jobs:
1717
runs-on: 'ubuntu-latest'
1818

1919
steps:
20-
- uses: 'actions/checkout@v4'
21-
22-
- uses: 'actions/setup-go@v4'
23-
with:
24-
go-version: '1.20'
25-
26-
- name: 'Get versions list'
27-
run: |-
28-
mkdir -p ./data
29-
go run ./cmd/compile-versions/main.go > ./data/versions.json
30-
31-
echo "Computed versions:"
32-
cat ./data/versions.json
33-
34-
- id: 'updates'
35-
name: 'Update versions list'
36-
run: |-
37-
if git diff --exit-code ./data/versions.json; then
38-
echo "No changes"
39-
exit 0
40-
fi
41-
42-
echo "had_changes=true" >> ${GITHUB_OUTPUT}
43-
44-
git config user.name "google-github-actions-bot"
45-
git config user.email "github-actions-bot@google.com"
46-
47-
git checkout -b "${{ env.PR_BRANCH }}"
48-
git add ./data/versions.json
49-
git commit -m "Update gcloud versions ($(date --iso-8601=h))"
50-
git push -f origin "${{ env.PR_BRANCH }}"
51-
52-
- name: 'Create Pull Request'
53-
if: steps.updates.outputs.had_changes == 'true'
54-
uses: 'actions/github-script@v6'
55-
with:
56-
github-token: '${{ secrets.ACTIONS_BOT_TOKEN }}'
57-
script: |-
58-
const baseBranch = `${{ github.ref_name }}`;
59-
const prBranch = `${{ env.PR_BRANCH }}`;
60-
const prBody = `Update latest gcloud versions`;
61-
62-
try {
63-
const listResponse = await github.rest.pulls.list({
64-
owner: context.repo.owner,
65-
repo: context.repo.repo,
66-
state: `open`,
67-
head: `${context.repo.owner}:${prBranch}`,
68-
base: baseBranch,
69-
});
70-
71-
core.isDebug() && console.log(listResponse);
72-
73-
if(!listResponse.data.length) {
74-
const createResponse = await github.rest.pulls.create({
20+
- uses: 'actions/checkout@v4'
21+
22+
- uses: 'actions/setup-go@v5'
23+
with:
24+
go-version: '1.22'
25+
26+
- name: 'Get versions list'
27+
run: |-
28+
mkdir -p ./data
29+
go run ./cmd/compile-versions/main.go > ./data/versions.json
30+
31+
echo "Computed versions:"
32+
cat ./data/versions.json
33+
34+
- id: 'updates'
35+
name: 'Update versions list'
36+
run: |-
37+
if git diff --exit-code ./data/versions.json; then
38+
echo "No changes"
39+
exit 0
40+
fi
41+
42+
echo "had_changes=true" >> ${GITHUB_OUTPUT}
43+
44+
git config user.name "google-github-actions-bot"
45+
git config user.email "github-actions-bot@google.com"
46+
47+
git checkout -b "${{ env.PR_BRANCH }}"
48+
git add ./data/versions.json
49+
git commit -m "Update gcloud versions ($(date --iso-8601=h))"
50+
git push -f origin "${{ env.PR_BRANCH }}"
51+
52+
- name: 'Create Pull Request'
53+
if: steps.updates.outputs.had_changes == 'true'
54+
uses: 'actions/github-script@v7'
55+
with:
56+
github-token: '${{ secrets.ACTIONS_BOT_TOKEN }}'
57+
script: |-
58+
const baseBranch = `${{ github.ref_name }}`;
59+
const prBranch = `${{ env.PR_BRANCH }}`;
60+
const prBody = `Update latest gcloud versions`;
61+
62+
try {
63+
const listResponse = await github.rest.pulls.list({
7564
owner: context.repo.owner,
7665
repo: context.repo.repo,
77-
title: `Update gcloud versions`,
78-
body: prBody,
79-
head: prBranch,
66+
state: `open`,
67+
head: `${context.repo.owner}:${prBranch}`,
8068
base: baseBranch,
8169
});
82-
core.info(`Created PR #${createResponse.data.number} at ${createResponse.data.html_url}`);
83-
} else {
84-
const updateResponse = await github.rest.pulls.update({
85-
owner: context.repo.owner,
86-
repo: context.repo.repo,
87-
pull_number: listResponse.data[0].number,
88-
title: `Update gcloud versions`,
89-
body: prBody,
90-
});
91-
core.info(`Updated PR #${updateResponse.data.number} at ${updateResponse.data.html_url}`);
70+
71+
core.isDebug() && console.log(listResponse);
72+
73+
if(!listResponse.data.length) {
74+
const createResponse = await github.rest.pulls.create({
75+
owner: context.repo.owner,
76+
repo: context.repo.repo,
77+
title: `Update gcloud versions`,
78+
body: prBody,
79+
head: prBranch,
80+
base: baseBranch,
81+
});
82+
core.info(`Created PR #${createResponse.data.number} at ${createResponse.data.html_url}`);
83+
} else {
84+
const updateResponse = await github.rest.pulls.update({
85+
owner: context.repo.owner,
86+
repo: context.repo.repo,
87+
pull_number: listResponse.data[0].number,
88+
title: `Update gcloud versions`,
89+
body: prBody,
90+
});
91+
core.info(`Updated PR #${updateResponse.data.number} at ${updateResponse.data.html_url}`);
92+
}
93+
} catch(err) {
94+
console.error(err);
95+
core.setFailed(`Failed to create pull request: ${err}`);
9296
}
93-
} catch(err) {
94-
console.error(err);
95-
core.setFailed(`Failed to create pull request: ${err}`);
96-
}

.github/workflows/release.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ on:
88

99
jobs:
1010
release:
11-
if: "startsWith(github.event.head_commit.message, 'Release: v')"
12-
name: 'Release'
11+
if: |-
12+
${{ startsWith(github.event.head_commit.message, 'Release: v') }}
1313
uses: 'google-github-actions/.github/.github/workflows/release.yml@v0'
14+
15+
publish:
16+
needs:
17+
- 'release'
18+
runs-on: 'ubuntu-latest'
19+
20+
steps:
21+
- uses: 'actions/checkout@v4'
22+
23+
- uses: 'actions/setup-node@v4'
24+
with:
25+
node-version: '20.x'
26+
registry-url: 'https://wombat-dressing-room.appspot.com/'
27+
28+
- env:
29+
NODE_AUTH_TOKEN: '${{ secrets.NODE_AUTH_TOKEN }}'
30+
run: |-
31+
npm publish

.github/workflows/unit.yml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,28 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
os:
24-
- 'ubuntu-latest'
25-
- 'windows-2022'
26-
- 'macos-latest'
27-
node:
28-
- '20.x'
24+
- 'ubuntu-latest'
25+
- 'windows-2022'
26+
- 'macos-latest'
2927
runs-on: '${{ matrix.os }}'
3028

3129
steps:
32-
- uses: 'actions/checkout@v4'
30+
- uses: 'actions/checkout@v4'
3331

34-
- uses: 'actions/setup-node@v4'
35-
with:
36-
node-version: '${{ matrix.node }}'
32+
- uses: 'actions/setup-node@v4'
33+
with:
34+
node-version: '20.x'
3735

38-
- name: 'npm build'
39-
run: 'npm ci && npm run build'
36+
- name: 'npm build'
37+
run: 'npm ci && npm run build'
4038

41-
- name: 'npm lint'
42-
# There's no need to run the linter for each operating system, since it
43-
# will find the same thing 9x and clog up the PR review.
44-
if: ${{ matrix.os == 'ubuntu-latest' }}
45-
run: 'npm run lint'
39+
- name: 'npm lint'
40+
# There's no need to run the linter for each operating system, since it
41+
# will find the same thing 9x and clog up the PR review.
42+
if: ${{ matrix.os == 'ubuntu-latest' }}
43+
run: 'npm run lint'
4644

47-
- name: 'npm test'
48-
env:
49-
SERVICE_ACCOUNT_KEY_JSON: '${{ secrets.SERVICE_ACCOUNT_KEY_JSON }}'
50-
run: 'npm run test'
45+
- name: 'npm test'
46+
env:
47+
SERVICE_ACCOUNT_KEY_JSON: '${{ secrets.SERVICE_ACCOUNT_KEY_JSON }}'
48+
run: 'npm run test'

go.mod

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,44 @@
11
module github.com/google-github-actions/setup-cloud-sdk
22

3-
go 1.20
3+
go 1.22
44

55
require (
6-
cloud.google.com/go/storage v1.31.0
7-
github.com/maruel/natural v1.1.0
8-
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090
9-
google.golang.org/api v0.126.0
6+
cloud.google.com/go/storage v1.40.0
7+
github.com/maruel/natural v1.1.1
8+
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8
9+
google.golang.org/api v0.172.0
1010
)
1111

1212
require (
13-
cloud.google.com/go v0.110.2 // indirect
14-
cloud.google.com/go/compute v1.19.3 // indirect
13+
cloud.google.com/go v0.112.2 // indirect
14+
cloud.google.com/go/compute v1.25.1 // indirect
1515
cloud.google.com/go/compute/metadata v0.2.3 // indirect
16-
cloud.google.com/go/iam v1.1.0 // indirect
16+
cloud.google.com/go/iam v1.1.7 // indirect
17+
github.com/felixge/httpsnoop v1.0.4 // indirect
18+
github.com/go-logr/logr v1.4.1 // indirect
19+
github.com/go-logr/stdr v1.2.2 // indirect
1720
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
18-
github.com/golang/protobuf v1.5.3 // indirect
19-
github.com/google/go-cmp v0.5.9 // indirect
20-
github.com/google/s2a-go v0.1.4 // indirect
21-
github.com/google/uuid v1.3.0 // indirect
22-
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
23-
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
21+
github.com/golang/protobuf v1.5.4 // indirect
22+
github.com/google/s2a-go v0.1.7 // indirect
23+
github.com/google/uuid v1.6.0 // indirect
24+
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
25+
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
2426
go.opencensus.io v0.24.0 // indirect
25-
golang.org/x/crypto v0.17.0 // indirect
26-
golang.org/x/net v0.17.0 // indirect
27-
golang.org/x/oauth2 v0.8.0 // indirect
28-
golang.org/x/sys v0.15.0 // indirect
27+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.50.0 // indirect
28+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.50.0 // indirect
29+
go.opentelemetry.io/otel v1.25.0 // indirect
30+
go.opentelemetry.io/otel/metric v1.25.0 // indirect
31+
go.opentelemetry.io/otel/trace v1.25.0 // indirect
32+
golang.org/x/crypto v0.22.0 // indirect
33+
golang.org/x/net v0.24.0 // indirect
34+
golang.org/x/oauth2 v0.19.0 // indirect
35+
golang.org/x/sync v0.7.0 // indirect
36+
golang.org/x/sys v0.19.0 // indirect
2937
golang.org/x/text v0.14.0 // indirect
30-
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
31-
google.golang.org/appengine v1.6.7 // indirect
32-
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
33-
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
34-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
35-
google.golang.org/grpc v1.56.3 // indirect
38+
golang.org/x/time v0.5.0 // indirect
39+
google.golang.org/genproto v0.0.0-20240412170617-26222e5d3d56 // indirect
40+
google.golang.org/genproto/googleapis/api v0.0.0-20240412170617-26222e5d3d56 // indirect
41+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240412170617-26222e5d3d56 // indirect
42+
google.golang.org/grpc v1.63.2 // indirect
3643
google.golang.org/protobuf v1.33.0 // indirect
3744
)

0 commit comments

Comments
 (0)