publish vscode package from action workflow #118
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: Integration | |
on: | |
push: {branches: [main]} | |
pull_request: {branches: [main]} | |
jobs: | |
validate: | |
name: Validate | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Install NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: latest | |
check-latest: true | |
cache: npm | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
check-latest: true | |
- name: Install VisualStudio | |
uses: egor-tensin/vs-shell@v2 | |
with: | |
arch: x64 | |
- name: Install Tools | |
run: | | |
addpath() { export PATH="$1:$PATH" && echo "$1" >> $GITHUB_PATH ; } | |
case "$RUNNER_OS" in | |
Linux) | |
sudo apt update | |
sudo apt install -y ninja-build | |
;; | |
macOS) | |
addpath "$(brew --prefix llvm@14)/bin" | |
brew install ninja | |
;; | |
Windows) | |
choco install ninja | |
;; | |
*) | |
echo "Unknown OS: $RUNNER_OS" | |
exit 1 | |
;; | |
esac | |
- name: Check Environment | |
run: | | |
trace() { echo "::group::$@" && "$@" && echo "::endgroup::" ; } | |
trace node --version | |
trace python --version | |
trace clang --version | |
trace clang++ --version | |
trace clang-format --version | |
trace clang-tidy --version | |
trace ninja --version | |
- name: Setup Cache | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-${{ hashFiles('addon/deps.json') }} | |
path: addon/gn | |
- name: Prepare Dependencies | |
run: npm ci | |
- name: Build Debug | |
run: npm run debug | |
- name: Run Test | |
run: npm test | |
- name: Build Release | |
run: npm run build | |
- name: Upload Archive | |
uses: actions/upload-artifact@v3 | |
if: ${{ runner.os == 'Linux' }} | |
with: | |
name: archive | |
path: | | |
README.md | |
CHANGELOG.md | |
LICENSE | |
package.json | |
build | |
!build/*.node | |
- name: Upload Addons | |
uses: actions/upload-artifact@v3 | |
with: | |
name: addons | |
path: build/*.node | |
build: | |
name: Build | |
needs: validate | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Archive | |
uses: actions/download-artifact@v3 | |
with: | |
name: archive | |
path: . | |
- name: Download Addons | |
uses: actions/download-artifact@v3 | |
with: | |
name: addons | |
path: build | |
- name: Generate Package | |
run: npx vsce package --out gnls.vsix | |
- name: Upload Package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: package | |
path: gnls.vsix | |
publish: | |
name: Publish | |
needs: build | |
runs-on: ubuntu-latest | |
# if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Download Package | |
uses: actions/download-artifact@v3 | |
with: | |
name: package | |
path: . | |
- name: Publish Package | |
run: npx vsce verify-pat # npx vsce publish --skip-duplicate --packagePath gnls.vsix |