Skip to content

Commit 122855d

Browse files
committed
feat: add release-please setup
1 parent 688a658 commit 122855d

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/interrogate.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2020 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
const {execSync} = require('child_process');
16+
execSync('git fetch origin master');
17+
const baseRef = process.env.GITHUB_BASE_REF;
18+
console.log(`base ref: ${baseRef}`);
19+
const status = execSync(`git diff --name-only origin/${baseRef}`, { encoding: 'utf-8'});
20+
console.log(status);
21+
const changes = status.split('\n');
22+
let nodePaths = new Set();
23+
let goPaths = new Set();
24+
let bashPaths = new Set();
25+
for (const change of changes) {
26+
if (change.startsWith('src/apis/')) {
27+
nodePaths.add(change.split('/')[2]);
28+
};
29+
}
30+
nodePaths = Array.from(nodePaths);
31+
console.log(`::set-output name=nodePaths::${JSON.stringify(nodePaths)}`);

.github/release-please.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
name: release-please
6+
jobs:
7+
changeFinder:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
nodePaths: ${{ steps.interrogate.outputs.nodePaths }}
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-node@v1
14+
with:
15+
node-version: 12
16+
- id: interrogate
17+
run: node ./.github/workflows/interrogate.js
18+
env:
19+
GITHUB_BASE_REF: ${{github.base_ref}}
20+
release:
21+
runs-on: ubuntu-latest
22+
needs: changeFinder
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
package: ${{fromJson(needs.changeFinder.outputs.nodePaths)}}
27+
steps:
28+
- uses: GoogleCloudPlatform/[email protected]
29+
with:
30+
path: ./src/apis/${{ matrix.package }}
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
release-type: node
33+
package-name: ${{ matrix.package }}
34+
monorepo-tags: true

0 commit comments

Comments
 (0)