Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add GitHub workflow file option
  • Loading branch information
badsyntax committed Dec 9, 2019
commit e785f6b5187bf403eacdc21bdfb561860dcc7f9b
34 changes: 34 additions & 0 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,17 @@ module.exports = class extends Generator {
generator.extensionConfig.pkgManager = pckgManagerAnswer.pkgManager;
});
},

askForGithubWorkflows: () => {
return generator.prompt({
type: 'confirm',
name: 'gitHubWorkFlowInit',
message: 'Include GitHub workflow file?',
default: true
}).then(gitAnswer => {
generator.extensionConfig.gitHubWorkFlowInit = gitAnswer.gitHubWorkFlowInit;
});
},
};

// run all prompts in sequence. Results can be ignored.
Expand Down Expand Up @@ -567,6 +578,9 @@ module.exports = class extends Generator {
this.fs.copy(this.sourceRoot() + '/gitignore', context.name + '/.gitignore');
this.fs.copy(this.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
}
if (this.extensionConfig.gitHubWorkFlowInit) {
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
}
}

// Write Color Theme Extension
Expand Down Expand Up @@ -600,6 +614,9 @@ module.exports = class extends Generator {
this.fs.copy(this.sourceRoot() + '/gitignore', context.name + '/.gitignore');
this.fs.copy(this.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
}
if (this.extensionConfig.gitHubWorkFlowInit) {
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
}
}

// Write Language Extension
Expand All @@ -624,6 +641,9 @@ module.exports = class extends Generator {
this.fs.copy(this.sourceRoot() + '/gitignore', context.name + '/.gitignore');
this.fs.copy(this.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
}
if (this.extensionConfig.gitHubWorkFlowInit) {
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
}
}

// Write Snippets Extension
Expand All @@ -641,6 +661,9 @@ module.exports = class extends Generator {
this.fs.copy(this.sourceRoot() + '/gitignore', context.name + '/.gitignore');
this.fs.copy(this.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
}
if (this.extensionConfig.gitHubWorkFlowInit) {
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
}
}

// Write Snippets Extension
Expand All @@ -657,6 +680,9 @@ module.exports = class extends Generator {
this.fs.copy(this.sourceRoot() + '/gitignore', context.name + '/.gitignore');
this.fs.copy(this.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');
}
if (this.extensionConfig.gitHubWorkFlowInit) {
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
}
}

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

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

if (this.extensionConfig.gitHubWorkFlowInit) {
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
}

this.extensionConfig.installDependencies = true;
}

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

if (this.extensionConfig.gitHubWorkFlowInit) {
this.fs.copy(this.sourceRoot() + '/github', context.name + '/.github');
}

this.extensionConfig.installDependencies = true;
}

Expand Down
6 changes: 5 additions & 1 deletion generators/app/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,9 @@ exports.writingLocalizationExtension = (generator) => {
generator.fs.copy(generator.sourceRoot() + '/gitignore', context.name + '/.gitignore');
generator.fs.copy(generator.sourceRoot() + '/gitattributes', context.name + '/.gitattributes');

if (context.gitHubWorkFlowInit) {
generator.fs.copy(generator.sourceRoot() + '/github', context.name + '/.github');
}

context.installDependencies = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish
on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Package extension
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Setting package version $tag"
npm --no-git-tag-version version "$tag"
npm install -g vsce
vsce package
- name: Publish extension to marketplace
env:
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
run: |
vsce publish -p "$AZURE_TOKEN"
1 change: 1 addition & 0 deletions generators/app/templates/ext-colortheme/vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
.github/**
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test & Publish
on:
push:
release:
types: [published]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12.x]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
if: matrix.os == 'ubuntu-latest'
- name: Test extension on ${{ matrix.os }}
run: |
npm ci
npm test
env:
DISPLAY: ':99.0'
CI: 'true'

publish:
needs: [test]
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Package extension
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Setting package version $tag"
npm --no-git-tag-version version "$tag"
npm install -g vsce
vsce package
- name: Publish extension to marketplace
env:
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
run: |
vsce publish -p "$AZURE_TOKEN"
1 change: 1 addition & 0 deletions generators/app/templates/ext-command-js/vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ vsc-extension-quickstart.md
**/jsconfig.json
**/*.map
**/.eslintrc.json
.github/**
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test & Publish
on:
push:
release:
types: [published]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12.x]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
if: matrix.os == 'ubuntu-latest'
- name: Test extension on ${{ matrix.os }}
run: |
npm ci
npm test
env:
DISPLAY: ':99.0'
CI: 'true'

publish:
needs: [test]
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Package extension
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Setting package version $tag"
npm --no-git-tag-version version "$tag"
npm install -g vsce
vsce package
- name: Publish extension to marketplace
env:
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
run: |
vsce publish -p "$AZURE_TOKEN"
3 changes: 2 additions & 1 deletion generators/app/templates/ext-command-ts/vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ vsc-extension-quickstart.md
**/tsconfig.json
**/tslint.json
**/*.map
**/*.ts
**/*.ts
.github/**
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish
on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Package extension
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Setting package version $tag"
npm --no-git-tag-version version "$tag"
npm install -g vsce
vsce package
- name: Publish extension to marketplace
env:
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
run: |
vsce publish -p "$AZURE_TOKEN"
1 change: 1 addition & 0 deletions generators/app/templates/ext-extensionpack/vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
.github/**
25 changes: 25 additions & 0 deletions generators/app/templates/ext-keymap/github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish
on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Package extension
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Setting package version $tag"
npm --no-git-tag-version version "$tag"
npm install -g vsce
vsce package
- name: Publish extension to marketplace
env:
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
run: |
vsce publish -p "$AZURE_TOKEN"
1 change: 1 addition & 0 deletions generators/app/templates/ext-keymap/vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
.github/**
25 changes: 25 additions & 0 deletions generators/app/templates/ext-language/github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish
on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Package extension
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Setting package version $tag"
npm --no-git-tag-version version "$tag"
npm install -g vsce
vsce package
- name: Publish extension to marketplace
env:
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
run: |
vsce publish -p "$AZURE_TOKEN"
1 change: 1 addition & 0 deletions generators/app/templates/ext-language/vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
.github/**
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish
on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Package extension
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Setting package version $tag"
npm --no-git-tag-version version "$tag"
npm install -g vsce
vsce package
- name: Publish extension to marketplace
env:
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
run: |
vsce publish -p "$AZURE_TOKEN"
1 change: 1 addition & 0 deletions generators/app/templates/ext-localization/vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.gitignore
vsc-extension-quickstart.md
node_modules
.github/**
Loading