Skip to content

Commit b40a346

Browse files
chore: regenerate templates (#346)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * chore(java_templates): add lint/static analysis presubmit checks for samples * chore(java_templates): add lint/static analysis presubmit checks for samples * chore: fix trailing whitespace Source-Author: Jeff Ching <chingor@google.com> Source-Date: Mon Aug 17 14:29:16 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: c3caf0704f25a0c365f1c315e804a30b87c62a75 Source-Link: googleapis/synthtool@c3caf07 * chore(java_templates): stop running pmd/spotbugs checks for samples This was creating too much noise. We will revisit with other options and/or tune these checks. Source-Author: Jeff Ching <chingor@google.com> Source-Date: Wed Aug 19 12:26:49 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 9602086c6c5b05db77950c7f7495a2a3868f3537 Source-Link: googleapis/synthtool@9602086 * fix: temporarily disable reporting to unblock releases Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Tue Aug 25 13:05:26 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 968465a1cad496e1292ef4584a054a35f756ff94 Source-Link: googleapis/synthtool@968465a * build(java): switch to release-publish app for notifying GitHub of release status Source-Author: Jeff Ching <chingor@google.com> Source-Date: Wed Aug 26 21:48:06 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 019c7168faa0e56619f792693a8acdb30d6de19b Source-Link: googleapis/synthtool@019c716 * build(ci): enable auto-release for dependency-update-only releases Automatically perform a Java client library release when: 1. Only dependency updates are going out in the release since any releases containing bug fixes, build changes or new features should be supervised; 2. There are no outstanding/open dependency update pull requests in the repo. This is to avoid multiple/redundant releases; 3. It is a SNAPSHOT release which is automatically generated post regular release -- this requires no human supervision. Testing done in 5 java-bigquery* client library repos. Example: [chore: release 0.3.4 ](googleapis/java-bigqueryconnection#130) [chore: release 0.3.5-SNAPSHOT](googleapis/java-bigqueryconnection#131) Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Thu Sep 17 15:30:02 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 538a68019eb4a36a0cdfa4021f324dd01b784395 Source-Link: googleapis/synthtool@538a680 * chore(java): set yoshi-java as default CODEOWNER Source-Author: Jeff Ching <chingor@google.com> Source-Date: Mon Sep 21 09:00:06 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 80003a3de2d8a75f5b47cb2e77e018f7f0f776cc Source-Link: googleapis/synthtool@80003a3 Co-authored-by: Jeff Ching <chingor@google.com>
1 parent 04b289d commit b40a346

5 files changed

Lines changed: 90 additions & 29 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
66

77
# The @googleapis/api-pubsub is the default owner for changes in this repo
8+
* @googleapis/yoshi-java @googleapis/api-pubsub
89
**/*.java @googleapis/api-pubsub
910

1011
# The java-samples-reviewers team is the default owner for samples changes
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
on:
2+
pull_request:
3+
name: auto-release
4+
jobs:
5+
approve:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/github-script@v3.0.0
9+
with:
10+
github-token: ${{secrets.GITHUB_TOKEN}}
11+
debug: true
12+
script: |
13+
// only approve PRs from release-please[bot]
14+
if (context.payload.pull_request.user.login !== "release-please[bot]") {
15+
return;
16+
}
17+
18+
// only approve PRs like "chore: release <release version>"
19+
if ( !context.payload.pull_request.title.startsWith("chore: release") ) {
20+
return;
21+
}
22+
23+
// trigger auto-release when
24+
// 1) it is a SNAPSHOT release (auto-generated post regular release)
25+
// 2) there are dependency updates only
26+
// 3) there are no open dependency update PRs in this repo (to avoid multiple releases)
27+
if (
28+
context.payload.pull_request.body.includes("Fix") ||
29+
context.payload.pull_request.body.includes("Build") ||
30+
context.payload.pull_request.body.includes("Documentation") ||
31+
context.payload.pull_request.body.includes("BREAKING CHANGES") ||
32+
context.payload.pull_request.body.includes("Features")
33+
) {
34+
console.log( "Not auto-releasing since it is not a dependency-update-only release." );
35+
return;
36+
}
37+
38+
const promise = github.pulls.list.endpoint({
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
state: 'open'
42+
});
43+
const open_pulls = await github.paginate(promise)
44+
45+
if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) {
46+
for ( const pull of open_pulls ) {
47+
if ( pull.title.startsWith("deps: update dependency") ) {
48+
console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." );
49+
return;
50+
}
51+
}
52+
}
53+
54+
// approve release PR
55+
await github.pulls.createReview({
56+
owner: context.repo.owner,
57+
repo: context.repo.repo,
58+
body: 'Rubber stamped release!',
59+
pull_number: context.payload.pull_request.number,
60+
event: 'APPROVE'
61+
});
62+
63+
// attach kokoro:force-run and automerge labels
64+
await github.issues.addLabels({
65+
owner: context.repo.owner,
66+
repo: context.repo.repo,
67+
issue_number: context.payload.pull_request.number,
68+
labels: ['kokoro:force-run', 'automerge']
69+
});

.github/workflows/samples.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
on:
2+
pull_request:
3+
name: samples
4+
jobs:
5+
lint:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- uses: actions/setup-java@v1
10+
with:
11+
java-version: 8
12+
- name: Run checkstyle
13+
run: mvn -P lint --quiet --batch-mode checkstyle:check
14+
working-directory: samples/snippets

.kokoro/release/stage.cfg

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,7 @@ action {
1313
}
1414
}
1515

16-
# Fetch the token needed for reporting release status to GitHub
17-
before_action {
18-
fetch_keystore {
19-
keystore_resource {
20-
keystore_config_id: 73713
21-
keyname: "yoshi-automation-github-key"
22-
}
23-
}
24-
}
25-
26-
# Fetch magictoken to use with Magic Github Proxy
27-
before_action {
28-
fetch_keystore {
29-
keystore_resource {
30-
keystore_config_id: 73713
31-
keyname: "releasetool-magictoken"
32-
}
33-
}
34-
}
35-
36-
# Fetch api key to use with Magic Github Proxy
37-
before_action {
38-
fetch_keystore {
39-
keystore_resource {
40-
keystore_config_id: 73713
41-
keyname: "magic-github-proxy-api-key"
42-
}
43-
}
16+
env_vars: {
17+
key: "SECRET_MANAGER_KEYS"
18+
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"
4419
}

synth.metadata

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"git": {
2020
"name": "synthtool",
2121
"remote": "https://github.com/googleapis/synthtool.git",
22-
"sha": "f8823dec98277a9516f2fb6fae9f58b3a59a23e1"
22+
"sha": "80003a3de2d8a75f5b47cb2e77e018f7f0f776cc"
2323
}
2424
}
2525
],
@@ -42,7 +42,9 @@
4242
".github/PULL_REQUEST_TEMPLATE.md",
4343
".github/release-please.yml",
4444
".github/trusted-contribution.yml",
45+
".github/workflows/auto-release.yaml",
4546
".github/workflows/ci.yaml",
47+
".github/workflows/samples.yaml",
4648
".kokoro/build.bat",
4749
".kokoro/build.sh",
4850
".kokoro/coerce_logs.sh",

0 commit comments

Comments
 (0)