-
-
Save murrayinman/1de553b369135c8679372d0f550b3812 to your computer and use it in GitHub Desktop.
GitHub action for release and deploy of a VS Code extension
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
on: | |
workflow_dispatch | |
name: Manual Release and Deploy | |
jobs: | |
manual_release: | |
runs-on: ubuntu-latest | |
env: | |
PACKAGE_NAME: my-package # package name in package.json | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Run NPM CI | |
run: npm ci | |
- name: get-npm-version | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@master | |
- name: Package Extension (VSIX) | |
uses: lannonbr/vsce-action@master | |
with: | |
args: "package" | |
# Needs to be zipped for uploading release asset (VSIX isn't a known content type) | |
- name: Zip VSIX | |
uses: thedoctor0/zip-release@master | |
with: | |
type: 'zip' | |
path: ${{ env.PACKAGE_NAME }}-${{ steps.package-version.outputs.current-version }}.vsix | |
filename: 'extension.zip' | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.package-version.outputs.current-version }} | |
release_name: ${{ steps.package-version.outputs.current-version }} | |
body_path: CHANGELOG_CURRENT.md # Store your current version's changelog in a file to be added as the release description | |
draft: false | |
prerelease: false | |
- name: Upload VSIX Zip to Release | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./extension.zip | |
asset_name: extension.zip | |
asset_content_type: application/zip | |
- name: Publish to Visual Studio Marketplace | |
uses: HaaLeo/publish-vscode-extension@v0 | |
with: | |
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} # Make sure to add your VS Marketplace token as a repository secret | |
registryUrl: https://marketplace.visualstudio.com | |
extensionFile: ${{ env.PACKAGE_NAME }}-${{ steps.package-version.outputs.current-version }}.vsix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment