|
| 1 | +name: Deploy to VS Code Marketplace |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request_target: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + |
| 17 | + test: |
| 18 | + name: test |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v5 |
| 22 | + - uses: oven-sh/setup-bun@v2 |
| 23 | + with: |
| 24 | + bun-version: latest |
| 25 | + - run: bun install --frozen-lockfile |
| 26 | + - run: bun run lint |
| 27 | + - run: bun run typecheck |
| 28 | + - run: bun run test |
| 29 | + |
| 30 | + changepacks: |
| 31 | + name: changepacks |
| 32 | + runs-on: ubuntu-latest |
| 33 | + permissions: |
| 34 | + # create pull request comments |
| 35 | + pull-requests: write |
| 36 | + |
| 37 | + # Actions > General > Workflow permissions for creating pull request |
| 38 | + # Create brench to create pull request |
| 39 | + contents: write |
| 40 | + needs: |
| 41 | + - test |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v5 |
| 44 | + - uses: changepacks/action@main |
| 45 | + id: changepacks |
| 46 | + with: |
| 47 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 48 | + outputs: |
| 49 | + changepacks: ${{ steps.changepacks.outputs.changepacks }} |
| 50 | + release_assets_urls: ${{ steps.changepacks.outputs.release_assets_urls }} |
| 51 | + |
| 52 | + upload-assets: |
| 53 | + needs: changepacks |
| 54 | + if: ${{ contains(needs.changepacks.outputs.changepacks, 'package.json') }} |
| 55 | + permissions: |
| 56 | + contents: write |
| 57 | + name: Upload Assets |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - name: Checkout |
| 61 | + uses: actions/checkout@v5 |
| 62 | + |
| 63 | + - uses: oven-sh/setup-bun@v2 |
| 64 | + with: |
| 65 | + bun-version: latest |
| 66 | + |
| 67 | + - run: bun install --frozen-lockfile |
| 68 | + |
| 69 | + - name: Package VSIX |
| 70 | + run: bunx @vscode/vsce package --no-dependencies |
| 71 | + |
| 72 | + - name: Upload Asset |
| 73 | + uses: owjs3901/upload-github-release-asset@main |
| 74 | + with: |
| 75 | + upload_url: ${{ fromJson(needs.changepacks.outputs.release_assets_urls)['package.json'] }} |
| 76 | + asset_path: react-component-lens-*.vsix |
| 77 | + |
| 78 | + publish: |
| 79 | + name: Publish |
| 80 | + runs-on: ubuntu-latest |
| 81 | + if: ${{ contains(needs.changepacks.outputs.changepacks, 'package.json') }} |
| 82 | + needs: |
| 83 | + - changepacks |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v5 |
| 86 | + - uses: oven-sh/setup-bun@v2 |
| 87 | + with: |
| 88 | + bun-version: latest |
| 89 | + - run: bun install --frozen-lockfile |
| 90 | + - name: Publish to VS Code Marketplace |
| 91 | + run: bunx @vscode/vsce publish --no-dependencies |
| 92 | + env: |
| 93 | + VSCE_PAT: ${{ secrets.VSCE_PAT }} |
0 commit comments