Skip to content

Commit

Permalink
test publish
Browse files Browse the repository at this point in the history
  • Loading branch information
hhpatel14 committed Feb 5, 2025
1 parent 48abc64 commit bcd1fed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: npm run compile

publish:
name: Fake Publish in Fork (Real in Main)
name: Package & Upload VSIX (Fake Publish in Fork, Real in Main)
runs-on: ubuntu-latest
needs: test # Ensure tests pass before publishing
if: github.event_name == 'release' # Ensure it only runs on a new release
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "16"
node-version: "21"

- name: Install vsce (VS Code Extension Manager)
run: npm install -g @vscode/vsce
Expand All @@ -59,14 +59,31 @@ jobs:
- name: Build Extension
run: npm run compile # Change if needed

# Step 5: Fake Publish on Fork, Real Publish on Main
# Step 5: Package the VSIX file and ensure "dist" directory exists
- name: Package the VSIX file
run: |
mkdir -p dist # Create the dist folder if it doesn't exist
vsce package -o dist/extension.vsix # Generate the VSIX file in "dist/"
# Step 6: Debugging Step - List dist directory
- name: Debug: List dist directory
run: ls -la dist/

# Step 7: Upload VSIX file as an artifact
- name: Upload VSIX Artifact
uses: actions/upload-artifact@v4
with:
name: vscode-extension
path: dist/*.vsix

# Step 8: Fake Publish on Fork, Real Publish on Main
- name: Fake Publish (If Fork) or Real Publish
env:
IS_FORK: ${{ github.repository_owner != 'hhpatel14' }}
IS_FORK: ${{ github.repository_owner == 'hhpatel14' }}
run: |
echo "Checking if this is a fork..."
if [ "$IS_FORK" = "true" ]; then
echo "This is a fork. Running fake publish..."
vsce package
else
echo "This is the main repo. Publishing to VS Code Marketplace..."
vsce publish --pat ${{ secrets.VSCE_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ node_modules/
data/
out/
build/
dist/
*.vsix

0 comments on commit bcd1fed

Please sign in to comment.