Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
setup_only: true
- name: install-deps
run: make install
run: npm ci
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seemed like we should use npm ci in CI, not npm install...

- name: build
run: npm run compile
- name: prepworkspaces
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Publish Extension

on:
release:
types: [published, prereleased]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Package extension (regular)
if: github.event.release.prerelease == false
run: npm run package
- name: Package extension (pre-release)
if: github.event.release.prerelease == true
run: npm run package:prerelease

- name: Set up git credentials
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
Comment on lines +32 to +33
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need this to do the git commit that will result below on vsce publish <version>, where the <version> comes from the release tag. (I'd like to try this in a pre-release, hence adding all of that duplicate machinery here.)

- name: Publish to VS Code Marketplace (regular)
if: github.event.release.prerelease == false
# NOTE: ${{github.event.release.tag_name}} is the tag name from the release.
# Ref: https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#release
# Using `@vscode/vsce publish <version>` will tag a new commit with the version in package.json.
# Ref: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#autoincrement-the-extension-version
run: npm exec @vscode/vsce publish ${{ github.event.release.tag_name }} --packagePath *.vsix
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Publish to VS Code Marketplace (pre-release)
if: github.event.release.prerelease == true
run: npm exec @vscode/vsce publish ${{ github.event.release.tag_name }} --pre-release --packagePath *.vsix
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}

- name: Push version commit
run: |
git push origin HEAD:${{ github.event.repository.default_branch }}
Comment on lines +50 to +52
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, I think after the action creates the commit, we should push the commit directly to HEAD (it'll just be bumping the "version" field in package.json to match the tag).

- name: Publish to OpenVSX (regular)
if: github.event.release.prerelease == false
run: npm exec ovsx publish *.vsix
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
- name: Publish to OpenVSX (pre-release)
if: github.event.release.prerelease == true
run: npm exec ovsx publish *.vsix --pre-release
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
Loading