Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(build): publish vscode extension when changed #2755

21 changes: 16 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
version: ${{ fromJson(steps.changelog.outputs.data).newVersion }}
last-version: ${{ fromJson(steps.changelog.outputs.data).lastVersion }}
changelog: ${{ fromJson(steps.changelog.outputs.data).changelog }}
vscode-wing-changed: ${{ steps.git-diff-vscode-wing.outputs.diff }}

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -111,6 +113,19 @@ jobs:
name: wingc
path: target/wasm32-wasi/release/wingc.wasm

- name: Derive appropriate SHAs for base and head for `nx affected` commands
id: setSHAs
uses: nrwl/nx-set-shas@v3

- name: Check git diff of VSCode Extension
id: git-diff-vscode-wing
run: |
if git diff --quiet ${{ steps.setSHAs.outputs.base }} ${{ github.sha }} -- apps/vscode-wing; then
echo "::set-output name=diff::false"
else
echo "::set-output name=diff::true"
fi

- name: Upload Extension
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -365,12 +380,8 @@ jobs:
repo-token: "${{ secrets.PROJEN_GITHUB_TOKEN }}"
tag: "v${{ needs.build.outputs.version }}"

- name: Check published VSCode Version
id: vscode-version
run: echo "version=$(npx -y vsce show Monada.vscode-wing --json | jq '.versions[0].version' -r)" >> $GITHUB_OUTPUT

- name: Publish Extension to Visual Studio Marketplace
if: ${{ steps.vscode-version.outputs.version != needs.build.outputs.version }}
if: needs.build.outputs.vscode-wing-changed == 'true'
uses: "HaaLeo/publish-vscode-extension@v1"
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
Expand Down
Loading