ci: don't trigger CI on both push and pull_request #733
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: vscode-playground | |
on: | |
- push | |
- pull_request | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
working-directory: examples/vscode-playground | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('examples/vscode-playground/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: | | |
npm i | |
npm i vsce | |
- name: Lint | |
run: npx eslint src/*.ts | |
- name: Compile | |
run: npm run compile | |
- name: Replace package.json version | |
run: | | |
replace_packagejson_version() { | |
version_line=$(grep -o '"version".*' $1) | |
version=$(python -m json.tool package.json | awk -F'"' '/version/{print $4}') | |
build_version=$version+$2 | |
build_version_line=${version_line/$version/$build_version} | |
sed -i "s|$version_line|$build_version_line|g" $1 | |
cat $1 | |
} | |
replace_packagejson_version package.json $GITHUB_RUN_ID | |
- name: Build VSIX | |
run: npx vsce package | |
- name: Validate VSIX | |
run: | | |
npx vsce ls | grep package.json | |
npx vsce ls | grep out/extension.js | |
- name: Upload VSIX | |
uses: actions/upload-artifact@v2 | |
with: | |
name: vscode-playground-vsix | |
# The path must be rooted from the directory GitHub Actions starts | |
# from, not the working-directory. | |
path: examples/vscode-playground/*.vsix | |
if-no-files-found: error |