|
| 1 | +name: Build Extension |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: extension-build-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + package: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Setup Node |
| 25 | + uses: actions/setup-node@v4 |
| 26 | + with: |
| 27 | + node-version: '20' |
| 28 | + cache: npm |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: npm ci |
| 32 | + |
| 33 | + - name: Compute CI version |
| 34 | + shell: bash |
| 35 | + run: | |
| 36 | + set -euo pipefail |
| 37 | + BASE_VERSION="$(node -p "require('./package.json').version.split('-')[0]")" |
| 38 | + CI_VERSION="${BASE_VERSION}-ci.${GITHUB_RUN_NUMBER}" |
| 39 | + node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); pkg.version='${CI_VERSION}'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');" |
| 40 | + echo "CI_VERSION=${CI_VERSION}" >> "$GITHUB_ENV" |
| 41 | + echo "VSIX_NAME=agentic-flow-${CI_VERSION}.vsix" >> "$GITHUB_ENV" |
| 42 | +
|
| 43 | + - name: Build extension |
| 44 | + run: npm run compile |
| 45 | + |
| 46 | + - name: Package VSIX |
| 47 | + shell: bash |
| 48 | + run: | |
| 49 | + set -euo pipefail |
| 50 | + mkdir -p dist |
| 51 | + npx @vscode/vsce package --out "dist/${VSIX_NAME}" |
| 52 | +
|
| 53 | + - name: Upload workflow artifact |
| 54 | + uses: actions/upload-artifact@v4 |
| 55 | + with: |
| 56 | + name: ${{ env.VSIX_NAME }} |
| 57 | + path: dist/${{ env.VSIX_NAME }} |
| 58 | + if-no-files-found: error |
| 59 | + |
| 60 | + - name: Publish prerelease on main |
| 61 | + if: github.ref == 'refs/heads/main' |
| 62 | + uses: softprops/action-gh-release@v2 |
| 63 | + with: |
| 64 | + tag_name: latest-build |
| 65 | + name: Latest Build |
| 66 | + prerelease: true |
| 67 | + make_latest: false |
| 68 | + target_commitish: ${{ github.sha }} |
| 69 | + files: dist/${{ env.VSIX_NAME }} |
| 70 | + body: | |
| 71 | + Automated extension build from `${{ github.sha }}`. |
| 72 | +
|
| 73 | + Version: `${{ env.CI_VERSION }}` |
| 74 | + Branch: `${{ github.ref_name }}` |
| 75 | + Commit: `${{ github.event.head_commit.message }}` |
0 commit comments