Skip to content

Commit 563bc15

Browse files
kinto0facebook-github-bot
authored andcommitted
deploy_extension github action
Summary: This diff adds a deploy_extensions github action which will deploy the extension on any changes to `pyre2/version.bzl`. This diff also switches the build action to use the version in `pyre2/version.bzl` so the extension version should always match the language server version in the marketplace. To manually update the extension, developers should update the version in version.bzl (see the doc comment). The version in `package.json` is not relevant because the build_extension action builds a specific version (`npx vsce package <platform> <version>`). this command updates package.json locally but does not get committed (if we don't want it modified we can `--no-update-package-json` on `npx vsce package` but I don't think it matters). if we want this to always be up to date with pyre2/version.bzl I can do that (I don't know if it matters). Users of the extension should generally be disabling auto update and selecting a specific version of the extension (matching their pypy version) if they want to stay in sync with an old version. {F1976279886} I also opened a PR [here](EclipseFdn/publish-extensions#842) in order to make it [available in the open VSX registry](facebook/pyre-check#975 (comment)) Reviewed By: stroxler Differential Revision: D71577667 fbshipit-source-id: 74e28230cf5bb1c6a33d72ad4f74f710277dbd77
1 parent 2d01c9c commit 563bc15

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

.github/workflows/build_extension.yml

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
name: build_extension
22
on:
33
workflow_dispatch:
4+
workflow_call:
45
push:
56

67
jobs:
8+
get_version:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
pyrefly_version: ${{ steps.pyrefly-version.outputs.PYREFLY_VERSION }}
12+
steps:
13+
- name: Checkout repo (to see version.bzl in nex step)
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0 # Get all history for all branches and tags
17+
- name: Get version
18+
id: pyrefly-version
19+
run: echo "PYREFLY_VERSION=$(sed -n -e 's/^VERSION = "\(.*\)"/\1/p' pyre2/version.bzl)" >> $GITHUB_OUTPUT
720
build_extension:
21+
needs: get_version
22+
if: success()
823
strategy:
924
fail-fast: false
1025
matrix:
@@ -61,11 +76,11 @@ jobs:
6176
- uses: actions/setup-node@v4
6277
with:
6378
node-version: 22
64-
- run: npm ci
65-
working-directory: lsp/
6679
- name: save platform name
6780
run: echo "platform=${{ matrix.platform }}-${{ matrix.arch }}" >> ${{ matrix.github_env }}
68-
- run: npx vsce package --target ${{ env.platform }}
81+
- run: npm ci
82+
working-directory: lsp/
83+
- run: npx vsce package --target ${{ env.platform }} ${{needs.get_version.outputs.pyrefly_version}}
6984
working-directory: lsp/
7085
- uses: actions/upload-artifact@v4
7186
with:
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: deploy_extension
2+
on:
3+
push:
4+
paths:
5+
- pyre2/version.bzl
6+
branches: [ main ]
7+
8+
jobs:
9+
build:
10+
uses: ./.github/workflows/build_extension.yml
11+
12+
publish:
13+
runs-on: ubuntu-latest
14+
needs: build
15+
if: success()
16+
steps:
17+
- name: upload
18+
uses: actions/download-artifact@v4
19+
- name: publish
20+
run: npx vsce publish --packagePath $(find . -iname *.vsix)
21+
env:
22+
VSCE_PAT: ${{ secrets.VSCE_PAT }}

pyre2/version.bzl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# IMPORTANT: *Any* change to this file will kick off an upload of a new version of pyrefly to PyPI,
2-
# although the upload will likely fail if you haven't changed the version number.
2+
# and a new VSCode extension although the upload will likely fail if you haven't changed the version number.
33
#
4-
# An automated PyPI release happens once a week. To update the version for a manual release:
4+
# An automated PyPI/extension release happens once a week. To update the version for a manual release:
55
# * The version number is in the format "<major>.<minor>.<patch>".
66
# * Do exactly ONE of the following:
77
# * Increase the patch number by 1 if the release contains only minor changes like bug fixes.

0 commit comments

Comments
 (0)