-
Notifications
You must be signed in to change notification settings - Fork 10
feat(vscode): publish release VSIX assets #171
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
Open
mshanemc
wants to merge
4
commits into
main
Choose a base branch
from
sm/publish-release-vsix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+178
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: Download Release VSIXs | ||
| description: Download VSIX assets from a GitHub release and determine its release type | ||
|
|
||
| inputs: | ||
| release-tag: | ||
| description: GitHub release tag containing the VSIX assets | ||
| required: true | ||
|
|
||
| outputs: | ||
| pre-release: | ||
| description: Whether the GitHub release is a pre-release | ||
| value: ${{ steps.release-type.outputs.pre-release }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Download VSIXs | ||
| id: download | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RELEASE_TAG: ${{ inputs.release-tag }} | ||
| run: | | ||
| mkdir extensions | ||
| gh release download "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --pattern '*.vsix' --dir extensions | ||
|
|
||
| if ! find extensions -type f -name '*.vsix' -print -quit | grep -q .; then | ||
| echo "No VSIX files found in release $RELEASE_TAG" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo 'Downloaded VSIX files:' | ||
| find extensions -type f -name '*.vsix' | ||
|
|
||
| - name: Detect release type | ||
| id: release-type | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RELEASE_TAG: ${{ inputs.release-tag }} | ||
| run: | | ||
| if gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --json isPrerelease --jq .isPrerelease | grep -qx true; then | ||
| echo 'pre-release=true' >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo 'pre-release=false' >> "$GITHUB_OUTPUT" | ||
| fi | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Publish Release VSIXs to Open VSX | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| release-tag: | ||
| description: GitHub release tag containing the VSIX assets | ||
| required: true | ||
| type: string | ||
| dry-run: | ||
| description: Download and inspect VSIXs without publishing | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| secrets: | ||
| IDEE_OVSX_PAT: | ||
| description: Open VSX publishing token | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download release VSIXs | ||
| id: release | ||
| uses: salesforcecli/github-workflows/.github/actions/vscode/download-release-vsix@03cb2583f2edf45cd7d2688f2a452ee29511229e | ||
| with: | ||
| release-tag: ${{ inputs.release-tag }} | ||
|
|
||
| - name: Publish VSIXs | ||
| env: | ||
| DRY_RUN: ${{ inputs.dry-run }} | ||
| IDEE_OVSX_PAT: ${{ secrets.IDEE_OVSX_PAT }} | ||
| PRE_RELEASE: ${{ steps.release.outputs.pre-release }} | ||
| run: | | ||
| while IFS= read -r -d '' vsix; do | ||
| args=("$vsix" -p "$IDEE_OVSX_PAT" --skip-duplicate) | ||
| pre_release_suffix='' | ||
| if [ "$PRE_RELEASE" = true ]; then | ||
| args+=(--pre-release) | ||
| pre_release_suffix=' --pre-release' | ||
| fi | ||
|
|
||
| if [ "$DRY_RUN" = true ]; then | ||
| echo "Would publish $vsix to Open VSX with --skip-duplicate${pre_release_suffix}" | ||
| continue | ||
| fi | ||
|
|
||
| npx ovsx publish "${args[@]}" | ||
| done < <(find extensions -type f -name '*.vsix' -print0) |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Publish Release VSIXs to VS Code Marketplace | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| release-tag: | ||
| description: GitHub release tag containing the VSIX assets | ||
| required: true | ||
| type: string | ||
| dry-run: | ||
| description: Download and inspect VSIXs without publishing | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| secrets: | ||
| VSCE_PERSONAL_ACCESS_TOKEN: | ||
| description: VS Code Marketplace publishing token | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download release VSIXs | ||
| id: release | ||
| uses: salesforcecli/github-workflows/.github/actions/vscode/download-release-vsix@03cb2583f2edf45cd7d2688f2a452ee29511229e | ||
| with: | ||
| release-tag: ${{ inputs.release-tag }} | ||
|
|
||
| - name: Publish VSIXs | ||
| env: | ||
| DRY_RUN: ${{ inputs.dry-run }} | ||
| PRE_RELEASE: ${{ steps.release.outputs.pre-release }} | ||
| VSCE_PERSONAL_ACCESS_TOKEN: ${{ secrets.VSCE_PERSONAL_ACCESS_TOKEN }} | ||
| run: | | ||
| while IFS= read -r -d '' vsix; do | ||
| args=(--packagePath "$vsix" --skip-duplicate) | ||
| if [ "$PRE_RELEASE" = true ]; then | ||
| args+=(--pre-release) | ||
| fi | ||
|
|
||
| if [ "$DRY_RUN" = true ]; then | ||
| echo "Would publish $vsix to the VS Code Marketplace: @vscode/vsce publish ${args[*]}" | ||
| continue | ||
| fi | ||
|
|
||
| VSCE_PAT="$VSCE_PERSONAL_ACCESS_TOKEN" npx @vscode/vsce publish "${args[@]}" | ||
| done < <(find extensions -type f -name '*.vsix' -print0) |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vsix has a property within the manifest that marks the artifact as pre-release. Providing a flag to influence which bucket it lands in is ineffective and may cause a failure if there is a mistmatch.
If the goal of this workflow is to simply publish it might be best to follow what the vsix says rather than imposing a bucket.