|
1 | 1 | name: Publish Extension |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | | - types: [closed] |
6 | | - workflow_dispatch: |
| 4 | + pull_request: |
| 5 | + types: [closed] |
| 6 | + workflow_dispatch: |
7 | 7 |
|
8 | 8 | env: |
9 | | - GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }} |
| 9 | + GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }} |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - publish-extension: |
13 | | - runs-on: ubuntu-latest |
14 | | - permissions: |
15 | | - contents: write # Required for pushing tags. |
16 | | - if: > |
17 | | - ( github.event_name == 'pull_request' && |
18 | | - github.event.pull_request.base.ref == 'main' && |
19 | | - contains(github.event.pull_request.title, 'Changeset version bump') ) || |
20 | | - github.event_name == 'workflow_dispatch' |
21 | | - steps: |
22 | | - - name: Checkout code |
23 | | - uses: actions/checkout@v4 |
24 | | - with: |
25 | | - ref: ${{ env.GIT_REF }} |
26 | | - - name: Setup Node.js and pnpm |
27 | | - uses: ./.github/actions/setup-node-pnpm |
28 | | - - name: Configure Git |
29 | | - run: | |
30 | | - git config user.name "github-actions[bot]" |
31 | | - git config user.email "github-actions[bot]@users.noreply.github.com" |
32 | | - - name: Create .env file |
33 | | - run: echo "POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}" >> .env |
34 | | - - name: Package Extension |
35 | | - run: | |
36 | | - current_package_version=$(node -p "require('./src/package.json').version") |
37 | | - pnpm vsix |
| 12 | + publish-extension: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + permissions: |
| 15 | + contents: write # Required for pushing tags. |
| 16 | + if: > |
| 17 | + ( github.event_name == 'pull_request' && |
| 18 | + github.event.pull_request.base.ref == 'main' && |
| 19 | + contains(github.event.pull_request.title, 'Changeset version bump') ) || |
| 20 | + github.event_name == 'workflow_dispatch' |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + ref: ${{ env.GIT_REF }} |
| 26 | + - name: Setup Node.js and pnpm |
| 27 | + uses: ./.github/actions/setup-node-pnpm |
| 28 | + - name: Configure Git |
| 29 | + run: | |
| 30 | + git config user.name "github-actions[bot]" |
| 31 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 32 | + - name: Create .env file |
| 33 | + run: echo "POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}" >> .env |
| 34 | + - name: Package Extension |
| 35 | + run: | |
| 36 | + current_package_version=$(node -p "require('./src/package.json').version") |
| 37 | + pnpm vsix |
38 | 38 |
|
39 | | - # Save VSIX contents to a temporary file to avoid broken pipe issues. |
40 | | - unzip -l bin/roo-cline-${current_package_version}.vsix > /tmp/roo-code-vsix-contents.txt |
| 39 | + # Save VSIX contents to a temporary file to avoid broken pipe issues. |
| 40 | + unzip -l bin/datacoves-copilot-${current_package_version}.vsix > /tmp/roo-code-vsix-contents.txt |
41 | 41 |
|
42 | | - # Check for required files. |
43 | | - grep -q "extension/package.json" /tmp/roo-code-vsix-contents.txt || exit 1 |
44 | | - grep -q "extension/package.nls.json" /tmp/roo-code-vsix-contents.txt || exit 1 |
45 | | - grep -q "extension/dist/extension.js" /tmp/roo-code-vsix-contents.txt || exit 1 |
46 | | - grep -q "extension/webview-ui/audio/celebration.wav" /tmp/roo-code-vsix-contents.txt || exit 1 |
47 | | - grep -q "extension/webview-ui/build/assets/index.js" /tmp/roo-code-vsix-contents.txt || exit 1 |
48 | | - grep -q "extension/assets/codicons/codicon.ttf" /tmp/roo-code-vsix-contents.txt || exit 1 |
49 | | - grep -q "extension/assets/vscode-material-icons/icons/3d.svg" /tmp/roo-code-vsix-contents.txt || exit 1 |
50 | | - grep -q ".env" /tmp/roo-code-vsix-contents.txt || exit 1 |
51 | | - |
52 | | - # Clean up temporary file. |
53 | | - rm /tmp/roo-code-vsix-contents.txt |
54 | | - - name: Create and Push Git Tag |
55 | | - run: | |
56 | | - current_package_version=$(node -p "require('./src/package.json').version") |
57 | | - git tag -a "v${current_package_version}" -m "Release v${current_package_version}" |
58 | | - git push origin "v${current_package_version}" --no-verify |
59 | | - echo "Successfully created and pushed git tag v${current_package_version}" |
60 | | - - name: Publish Extension |
61 | | - env: |
62 | | - VSCE_PAT: ${{ secrets.VSCE_PAT }} |
63 | | - OVSX_PAT: ${{ secrets.OVSX_PAT }} |
64 | | - run: | |
65 | | - current_package_version=$(node -p "require('./src/package.json').version") |
66 | | - pnpm --filter roo-cline publish:marketplace |
67 | | - echo "Successfully published version $current_package_version to VS Code Marketplace" |
68 | | - - name: Create GitHub Release |
69 | | - env: |
70 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
71 | | - run: | |
72 | | - current_package_version=$(node -p "require('./src/package.json').version") |
| 42 | + # Check for required files. |
| 43 | + grep -q "extension/package.json" /tmp/roo-code-vsix-contents.txt || exit 1 |
| 44 | + grep -q "extension/package.nls.json" /tmp/roo-code-vsix-contents.txt || exit 1 |
| 45 | + grep -q "extension/dist/extension.js" /tmp/roo-code-vsix-contents.txt || exit 1 |
| 46 | + grep -q "extension/webview-ui/audio/celebration.wav" /tmp/roo-code-vsix-contents.txt || exit 1 |
| 47 | + grep -q "extension/webview-ui/build/assets/index.js" /tmp/roo-code-vsix-contents.txt || exit 1 |
| 48 | + grep -q "extension/assets/codicons/codicon.ttf" /tmp/roo-code-vsix-contents.txt || exit 1 |
| 49 | + grep -q "extension/assets/vscode-material-icons/icons/3d.svg" /tmp/roo-code-vsix-contents.txt || exit 1 |
| 50 | + grep -q ".env" /tmp/roo-code-vsix-contents.txt || exit 1 |
73 | 51 |
|
74 | | - # Extract changelog for current version |
75 | | - echo "Extracting changelog for version ${current_package_version}" |
76 | | - changelog_content=$(sed -n "/## \\[${current_package_version}\\]/,/## \\[/p" CHANGELOG.md | sed '$d') |
| 52 | + # Clean up temporary file. |
| 53 | + rm /tmp/roo-code-vsix-contents.txt |
| 54 | + - name: Create and Push Git Tag |
| 55 | + run: | |
| 56 | + current_package_version=$(node -p "require('./src/package.json').version") |
| 57 | + git tag -a "v${current_package_version}" -m "Release v${current_package_version}" |
| 58 | + git push origin "v${current_package_version}" --no-verify |
| 59 | + echo "Successfully created and pushed git tag v${current_package_version}" |
| 60 | + - name: Publish Extension |
| 61 | + env: |
| 62 | + VSCE_PAT: ${{ secrets.VSCE_PAT }} |
| 63 | + OVSX_PAT: ${{ secrets.OVSX_PAT }} |
| 64 | + run: | |
| 65 | + current_package_version=$(node -p "require('./src/package.json').version") |
| 66 | + pnpm --filter datacoves-copilot publish:marketplace |
| 67 | + echo "Successfully published version $current_package_version to VS Code Marketplace" |
| 68 | + - name: Create GitHub Release |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + run: | |
| 72 | + current_package_version=$(node -p "require('./src/package.json').version") |
77 | 73 |
|
78 | | - # If changelog extraction failed, use a default message |
79 | | - if [ -z "$changelog_content" ]; then |
80 | | - echo "Warning: No changelog section found for version ${current_package_version}" |
81 | | - changelog_content="Release v${current_package_version}" |
82 | | - else |
83 | | - echo "Found changelog section for version ${current_package_version}" |
84 | | - fi |
| 74 | + # Extract changelog for current version |
| 75 | + echo "Extracting changelog for version ${current_package_version}" |
| 76 | + changelog_content=$(sed -n "/## \\[${current_package_version}\\]/,/## \\[/p" CHANGELOG.md | sed '$d') |
85 | 77 |
|
86 | | - # Create release with changelog content |
87 | | - gh release create "v${current_package_version}" \ |
88 | | - --title "Release v${current_package_version}" \ |
89 | | - --notes "$changelog_content" \ |
90 | | - --target ${{ env.GIT_REF }} \ |
91 | | - bin/roo-cline-${current_package_version}.vsix |
92 | | - echo "Successfully created GitHub Release v${current_package_version}" |
| 78 | + # If changelog extraction failed, use a default message |
| 79 | + if [ -z "$changelog_content" ]; then |
| 80 | + echo "Warning: No changelog section found for version ${current_package_version}" |
| 81 | + changelog_content="Release v${current_package_version}" |
| 82 | + else |
| 83 | + echo "Found changelog section for version ${current_package_version}" |
| 84 | + fi |
| 85 | +
|
| 86 | + # Create release with changelog content |
| 87 | + gh release create "v${current_package_version}" \ |
| 88 | + --title "Release v${current_package_version}" \ |
| 89 | + --notes "$changelog_content" \ |
| 90 | + --target ${{ env.GIT_REF }} \ |
| 91 | + bin/datacoves-copilot-${current_package_version}.vsix |
| 92 | + echo "Successfully created GitHub Release v${current_package_version}" |
0 commit comments