Skip to content

Commit e785f6b

Browse files
committed
Add GitHub workflow file option
1 parent 53e39e3 commit e785f6b

File tree

20 files changed

+323
-15
lines changed

20 files changed

+323
-15
lines changed

generators/app/index.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,17 @@ module.exports = class extends Generator {
504504
generator.extensionConfig.pkgManager = pckgManagerAnswer.pkgManager;
505505
});
506506
},
507+
508+
askForGithubWorkflows: () => {
509+
return generator.prompt({
510+
type: 'confirm',
511+
name: 'gitHubWorkFlowInit',
512+
message: 'Include GitHub workflow file?',
513+
default: true
514+
}).then(gitAnswer => {
515+
generator.extensionConfig.gitHubWorkFlowInit = gitAnswer.gitHubWorkFlowInit;
516+
});
517+
},
507518
};
508519

509520
// run all prompts in sequence. Results can be ignored.
@@ -567,6 +578,9 @@ module.exports = class extends Generator {
567578
this.fs.copy(this.sourceRoot() + '/gitignore', context.name + '/.gitignore');
568579
this.fs.copy(this.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
569580
}
581+
if (this.extensionConfig.gitHubWorkFlowInit) {
582+
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
583+
}
570584
}
571585

572586
// Write Color Theme Extension
@@ -600,6 +614,9 @@ module.exports = class extends Generator {
600614
this.fs.copy(this.sourceRoot() + '/gitignore', context.name + '/.gitignore');
601615
this.fs.copy(this.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
602616
}
617+
if (this.extensionConfig.gitHubWorkFlowInit) {
618+
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
619+
}
603620
}
604621

605622
// Write Language Extension
@@ -624,6 +641,9 @@ module.exports = class extends Generator {
624641
this.fs.copy(this.sourceRoot() + '/gitignore', context.name + '/.gitignore');
625642
this.fs.copy(this.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
626643
}
644+
if (this.extensionConfig.gitHubWorkFlowInit) {
645+
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
646+
}
627647
}
628648

629649
// Write Snippets Extension
@@ -641,6 +661,9 @@ module.exports = class extends Generator {
641661
this.fs.copy(this.sourceRoot() + '/gitignore', context.name + '/.gitignore');
642662
this.fs.copy(this.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
643663
}
664+
if (this.extensionConfig.gitHubWorkFlowInit) {
665+
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
666+
}
644667
}
645668

646669
// Write Snippets Extension
@@ -657,6 +680,9 @@ module.exports = class extends Generator {
657680
this.fs.copy(this.sourceRoot() + '/gitignore', context.name + '/.gitignore');
658681
this.fs.copy(this.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
659682
}
683+
if (this.extensionConfig.gitHubWorkFlowInit) {
684+
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
685+
}
660686
}
661687

662688
// Write Command Extension (TypeScript)
@@ -680,6 +706,10 @@ module.exports = class extends Generator {
680706

681707
this.fs.copy(this.sourceRoot() + '/tslint.json', context.name + '/tslint.json');
682708

709+
if (this.extensionConfig.gitHubWorkFlowInit) {
710+
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
711+
}
712+
683713
this.extensionConfig.installDependencies = true;
684714
}
685715

@@ -705,6 +735,10 @@ module.exports = class extends Generator {
705735
this.fs.copyTpl(this.sourceRoot() + '/package.json', context.name + '/package.json', context);
706736
this.fs.copyTpl(this.sourceRoot() + '/.eslintrc.json', context.name + '/.eslintrc.json', context);
707737

738+
if (this.extensionConfig.gitHubWorkFlowInit) {
739+
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
740+
}
741+
708742
this.extensionConfig.installDependencies = true;
709743
}
710744

generators/app/localization.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,9 @@ exports.writingLocalizationExtension = (generator) => {
7373
generator.fs.copy(generator.sourceRoot() + '/gitignore', context.name + '/.gitignore');
7474
generator.fs.copy(generator.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
7575

76+
if (context.gitHubWorkFlowInit) {
77+
generator.fs.copy(generator.sourceRoot() + '/github', context.name + '/.github');
78+
}
79+
7680
context.installDependencies = true;
77-
}
81+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-18.04
9+
steps:
10+
- uses: actions/checkout@v1
11+
- uses: actions/setup-node@v1
12+
with:
13+
node-version: 12.x
14+
- name: Package extension
15+
run: |
16+
tag=${GITHUB_REF#refs/tags/}
17+
echo "Setting package version $tag"
18+
npm --no-git-tag-version version "$tag"
19+
npm install -g vsce
20+
vsce package
21+
- name: Publish extension to marketplace
22+
env:
23+
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
24+
run: |
25+
vsce publish -p "$AZURE_TOKEN"

generators/app/templates/ext-colortheme/vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.vscode-test/**
33
.gitignore
44
vsc-extension-quickstart.md
5+
.github/**
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Test & Publish
2+
on:
3+
push:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
test:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
node-version: [12.x]
13+
os: [ubuntu-latest, windows-latest, macOS-latest]
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- name: Start Xvfb
21+
run: |
22+
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
23+
if: matrix.os == 'ubuntu-latest'
24+
- name: Test extension on ${{ matrix.os }}
25+
run: |
26+
npm ci
27+
npm test
28+
env:
29+
DISPLAY: ':99.0'
30+
CI: 'true'
31+
32+
publish:
33+
needs: [test]
34+
if: github.event_name == 'release' && github.event.action == 'published'
35+
runs-on: ubuntu-18.04
36+
steps:
37+
- uses: actions/checkout@v1
38+
- uses: actions/setup-node@v1
39+
with:
40+
node-version: 12.x
41+
- name: Package extension
42+
run: |
43+
tag=${GITHUB_REF#refs/tags/}
44+
echo "Setting package version $tag"
45+
npm --no-git-tag-version version "$tag"
46+
npm install -g vsce
47+
vsce package
48+
- name: Publish extension to marketplace
49+
env:
50+
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
51+
run: |
52+
vsce publish -p "$AZURE_TOKEN"

generators/app/templates/ext-command-js/vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ vsc-extension-quickstart.md
66
**/jsconfig.json
77
**/*.map
88
**/.eslintrc.json
9+
.github/**
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Test & Publish
2+
on:
3+
push:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
test:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
node-version: [12.x]
13+
os: [ubuntu-latest, windows-latest, macOS-latest]
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- name: Start Xvfb
21+
run: |
22+
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
23+
if: matrix.os == 'ubuntu-latest'
24+
- name: Test extension on ${{ matrix.os }}
25+
run: |
26+
npm ci
27+
npm test
28+
env:
29+
DISPLAY: ':99.0'
30+
CI: 'true'
31+
32+
publish:
33+
needs: [test]
34+
if: github.event_name == 'release' && github.event.action == 'published'
35+
runs-on: ubuntu-18.04
36+
steps:
37+
- uses: actions/checkout@v1
38+
- uses: actions/setup-node@v1
39+
with:
40+
node-version: 12.x
41+
- name: Package extension
42+
run: |
43+
tag=${GITHUB_REF#refs/tags/}
44+
echo "Setting package version $tag"
45+
npm --no-git-tag-version version "$tag"
46+
npm install -g vsce
47+
vsce package
48+
- name: Publish extension to marketplace
49+
env:
50+
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
51+
run: |
52+
vsce publish -p "$AZURE_TOKEN"

generators/app/templates/ext-command-ts/vscodeignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ vsc-extension-quickstart.md
77
**/tsconfig.json
88
**/tslint.json
99
**/*.map
10-
**/*.ts
10+
**/*.ts
11+
.github/**
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-18.04
9+
steps:
10+
- uses: actions/checkout@v1
11+
- uses: actions/setup-node@v1
12+
with:
13+
node-version: 12.x
14+
- name: Package extension
15+
run: |
16+
tag=${GITHUB_REF#refs/tags/}
17+
echo "Setting package version $tag"
18+
npm --no-git-tag-version version "$tag"
19+
npm install -g vsce
20+
vsce package
21+
- name: Publish extension to marketplace
22+
env:
23+
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
24+
run: |
25+
vsce publish -p "$AZURE_TOKEN"

generators/app/templates/ext-extensionpack/vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.vscode-test/**
33
.gitignore
44
vsc-extension-quickstart.md
5+
.github/**

0 commit comments

Comments
 (0)