Skip to content

Merge pull request #67 from FloSch62/stream_impro #8

Merge pull request #67 from FloSch62/stream_impro

Merge pull request #67 from FloSch62/stream_impro #8

Workflow file for this run

name: Pre-Release
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/**'
- '!.github/workflows/pre-release.yml'
concurrency:
group: pre-release
cancel-in-progress: true
jobs:
pre-release:
runs-on: ubuntu-latest
# Only run on the main repository, not on forks
if: |
github.repository == 'eda-labs/vscode-eda' &&
!contains(github.event.head_commit.message, '[skip ci]')
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Get version info
id: version
run: |
# Get current version from package.json
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
# Get latest release tag (excluding pre-releases)
LATEST_TAG=$(git tag -l "v*" | grep -v "\-pre" | sort -V | tail -n1 || echo "")
if [ -z "$LATEST_TAG" ]; then
echo "No stable releases found, checking all tags..."
# If no stable releases, get the latest tag without -pre suffix
ALL_TAGS=$(git tag -l "v*" | sort -V)
for tag in $ALL_TAGS; do
# Extract version without -pre suffix
VERSION_WITHOUT_PRE="${tag%-pre}"
VERSION_WITHOUT_PRE="${VERSION_WITHOUT_PRE#v}"
LATEST_VERSION="$VERSION_WITHOUT_PRE"
done
if [ -z "$LATEST_VERSION" ]; then
LATEST_VERSION="0.0.0"
fi
else
LATEST_VERSION="${LATEST_TAG#v}"
fi
echo "latest=$LATEST_VERSION" >> $GITHUB_OUTPUT
# Check if current version is higher
if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ] || [ "$(printf '%s\n' "$LATEST_VERSION" "$CURRENT_VERSION" | sort -V | head -n1)" = "$CURRENT_VERSION" ]; then
echo "❌ Current version ($CURRENT_VERSION) must be higher than latest release ($LATEST_VERSION)"
echo "Please bump the version in package.json before pushing to main"
exit 1
fi
echo "✅ Version check passed: $CURRENT_VERSION > $LATEST_VERSION"
- name: Run linter
run: npm run lint
- name: Run type check
run: npm run check-types
- name: Run tests
run: npm test
- name: Build extension
run: npm run compile
- name: Package extension
run: |
npm install -g @vscode/vsce
vsce package --pre-release -o "vscode-eda-${{ steps.version.outputs.current }}.vsix"
- name: Check for VS Code PAT
id: check-pat
run: |
if [ -n "${{ secrets.VSCE_PAT }}" ]; then
echo "has_pat=true" >> $GITHUB_OUTPUT
else
echo "has_pat=false" >> $GITHUB_OUTPUT
echo "⚠️ VSCE_PAT secret not configured - skipping marketplace publish"
fi
- name: Publish to VS Code Marketplace (Pre-release)
if: steps.check-pat.outputs.has_pat == 'true'
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: vsce publish --pre-release -p $VSCE_PAT
- name: Delete old pre-releases
uses: dev-drprasad/[email protected]
with:
keep_latest: 3
delete_tag_pattern: v.*-pre
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create pre-release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.current }}-pre
name: Pre-release v${{ steps.version.outputs.current }}
body: |
## 🚀 Pre-release Build
This is an automated pre-release build from the latest commit on the main branch.
**Version:** ${{ steps.version.outputs.current }}
**Commit:** ${{ github.sha }}
### Installation
1. Download the `.vsix` file from the assets below
2. In VS Code, open the Command Palette (`Ctrl/Cmd + Shift + P`)
3. Run "Extensions: Install from VSIX..."
4. Select the downloaded file
⚠️ **Note:** This is a pre-release version and may contain unstable features.
draft: false
prerelease: true
files: |
vscode-eda-${{ steps.version.outputs.current }}.vsix
generate_release_notes: true