Update build.yml #6
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 and Upload VSCode Extension as Artifact | |
on: | |
push: | |
branches: | |
- main # Trigger the action when pushing to the main branch (adjust if you use a different branch) | |
pull_request: | |
branches: | |
- main # Trigger the action when a PR is opened to the main branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest # You can change this to 'windows-latest' or 'macos-latest' if needed | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js 20 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' # Change Node.js version to 20 | |
- name: Install dependencies | |
run: npm install | |
- name: Install VSCE | |
run: npm install -g @vscode/vsce | |
- name: Build VSCode Extension | |
run: vsce package # This will generate the .vsix package of your extension | |
- name: Get package version | |
id: get_version | |
run: echo "PACKAGE_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v${{ env.PACKAGE_VERSION }} | |
release_name: Release v${{ env.PACKAGE_VERSION }} | |
body: | | |
This is the release for version v${{ env.PACKAGE_VERSION }} of the extension. | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: './*.vsix' | |
asset_name: 'Flarial Flarial scripting extention.vsix' | |
asset_content_type: 'application/octet-stream' | |
- name: Upload VSCode Extension as Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: vscode-extension # Name of the artifact (you can change this) | |
path: '*.vsix' # Path to the .vsix file (adjust this if your file is in a subdirectory) |