Build IDE Extensions #1
Workflow file for this run
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
| name: Build IDE Extensions | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| build-vscode-extension: | |
| name: Build VS Code Extension | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: vscode-extension/package-lock.json | |
| - name: Install dependencies | |
| working-directory: vscode-extension | |
| run: npm ci | |
| - name: Compile TypeScript | |
| working-directory: vscode-extension | |
| run: npm run compile | |
| - name: Install vsce | |
| run: npm install -g @vscode/vsce | |
| - name: Package extension | |
| working-directory: vscode-extension | |
| run: vsce package | |
| - name: Get extension version | |
| id: get_version | |
| working-directory: vscode-extension | |
| run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Upload VS Code extension to release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: vscode-extension/guard-rail-vscode-${{ steps.get_version.outputs.version }}.vsix | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-intellij-extension: | |
| name: Build IntelliJ Extension | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'corretto' | |
| java-version: '17' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Grant execute permission for gradlew | |
| working-directory: intellij-extension | |
| run: chmod +x gradlew | |
| - name: Build plugin | |
| working-directory: intellij-extension | |
| run: ./gradlew buildPlugin | |
| - name: Get plugin version | |
| id: get_version | |
| working-directory: intellij-extension | |
| run: echo "version=$(grep '^version = ' build.gradle.kts | cut -d '"' -f 2)" >> $GITHUB_OUTPUT | |
| - name: Find built plugin | |
| id: find_plugin | |
| working-directory: intellij-extension | |
| run: | | |
| PLUGIN_FILE=$(find build/distributions -name "*.zip" -type f | head -n 1) | |
| echo "plugin_file=$PLUGIN_FILE" >> $GITHUB_OUTPUT | |
| echo "plugin_name=$(basename $PLUGIN_FILE)" >> $GITHUB_OUTPUT | |
| - name: Upload IntelliJ plugin to release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: intellij-extension/${{ steps.find_plugin.outputs.plugin_file }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |