correct method to save vsix filename to env variable #105
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: Build Workflow | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build on ${{ matrix.os }}-${{ matrix.arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
arch: win32-x64 | |
- os: windows-latest | |
arch: win32-arm64 | |
- os: macos-12 | |
arch: darwin-x64 | |
- os: macos-14 | |
arch: darwin-arm64 | |
- os: ubuntu-22.04 | |
arch: linux-x64 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
ref: 'main' | |
fetch-depth: 0 | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: ">=20.11.0" | |
registry-url: "https://registry.npmjs.org/" | |
cache: 'npm' | |
- name: Install dependencies on Windows | |
if: startsWith(matrix.os, 'windows') | |
run: .\install-dependencies.ps1 | |
shell: pwsh | |
- name: Install dependencies on Unix | |
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') | |
run: ./install-dependencies.sh | |
shell: bash | |
- name: Run build script for Windows | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
npm install -g @vscode/vsce | |
cd extensions/vscode | |
node scripts/prepackage --target "${{ matrix.arch }}" | |
mkdir build | |
vsce package --out .\build --target "${{ matrix.arch }}" | |
echo "Finished Packaging extension..." | |
echo "Listing build..." | |
ls build | |
cd build | |
$VSIX_FILE = Get-ChildItem -Path . -Filter *.vsix | Select-Object -ExpandProperty Name | |
echo "VSIX_FILE=$VSIX_FILE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
shell: pwsh | |
- name: Run build script for Linux | |
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') | |
run: | | |
cd extensions/vscode | |
node scripts/prepackage --target "${{ matrix.arch }}" | |
mkdir build | |
node_modules/@vscode/vsce/vsce package --out ./build --target "${{ matrix.arch }}" | |
cd build && echo "VSIX_FILE=$(ls *.vsix)" >> $GITHUB_ENV | |
shell: bash | |
- name: Publish Extension | |
run: | | |
cd extensions/vscode/build | |
../node_modules/@vscode/vsce/vsce publish --pat ${{ secrets.VS_MARKETPLACE_TOKEN }} --packagePath ${{ env.VSIX_FILE }} | |
- name: Archive build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.VSIX_FILE }} | |
path: extensions/vscode/build/${{ env.VSIX_FILE }} |