This repository has been archived by the owner on Jan 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
48 lines (44 loc) · 1.93 KB
/
create_release_pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Create PR to Trigger Release
on: workflow_dispatch
jobs:
create_release_pr:
name: Create PR to Trigger Release
runs-on: ubuntu-20.04
env:
IMJS_ELECTRON_CLIENT_ID: imodeljs-electron-samples
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: |
git config --global user.email "[email protected]"
git config --global user.name "imodeljs-admin[bot]"
name: git config
- uses: actions/github-script@v2
with:
script: |
const proc = require('child_process');
const capture = (prog, args) => { console.log(`$ ${prog} ${args}`); return proc.spawnSync(prog, args).stdout.toString().trim(); };
const run = (prog, args) => { console.log(`$ ${prog} ${args}`); proc.spawnSync(prog, args, { stdio: 'inherit' }); };
const runWithOpts = async (funcName, opts) => {
console.log(`${funcName} opts: ${JSON.stringify(opts)}`);
const res = await eval(funcName)(opts);
console.log(`${funcName} response: ${JSON.stringify(res)}`);
return res;
};
const newVersion = capture('npm', ['version', 'patch', '--no-git-tag-version']);
console.log(`newVersion='${newVersion}'`);
run('git', ['checkout', '-b', newVersion]);
run('git', ['add', '.']);
run('git', ['status']);
run('git', ['diff']);
run('git', ['commit', '-m', newVersion]);
run('git', ['push', '-u', 'origin', 'HEAD']);
await runWithOpts('github.pulls.create', {
owner: context.repo.owner,
repo: context.repo.repo,
title: `[Bump Version] ${newVersion}`,
head: newVersion,
base: 'master'
});