v0.0.0 #5
Workflow file for this run
This file contains 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
name: Basic CI | |
on: | |
push: | |
branches: | |
- "master" # Trigger only on pushes to the master branch | |
pull_request: | |
branches: | |
- "master" # Trigger on pull requests targeting the master branch | |
release: | |
types: | |
- created # Run when a new release is created | |
jobs: | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest # Use Ubuntu for the runner | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Step 2: Set up Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "16" # Specify the Node.js version | |
# Step 3: Install dependencies | |
- name: Install dependencies | |
run: npm install | |
# Step 4: Compile the project | |
- name: Compile the project | |
run: npm run compile | |
publish: | |
name: 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 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "16" | |
- name: Install vsce (VS Code Extension Manager) | |
run: npm install -g @vscode/vsce | |
- name: Install Dependencies | |
run: npm install | |
- name: Build Extension | |
run: npm run compile # Change if needed | |
# Step 5: Fake Publish on Fork, Real Publish on Main | |
- name: Fake Publish (If Fork) or Real Publish | |
env: | |
IS_FORK: ${{ github.repository_owner == 'hhpatel14' }} | |
run: | | |
echo "This is a fork. Running fake publish..." | |
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..." | |
fi |