|
| 1 | +name: CI |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + os: [macos-latest, ubuntu-latest, windows-latest] |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: Install Node.js |
| 22 | + uses: actions/setup-node@v3 |
| 23 | + with: |
| 24 | + node-version: 18.x |
| 25 | + |
| 26 | + - name: Install pnpm |
| 27 | + uses: pnpm/action-setup@v2 |
| 28 | + id: pnpm-install |
| 29 | + with: |
| 30 | + version: 8 |
| 31 | + run_install: false |
| 32 | + |
| 33 | + - name: Get pnpm store directory |
| 34 | + id: pnpm-cache |
| 35 | + shell: bash |
| 36 | + run: | |
| 37 | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT |
| 38 | +
|
| 39 | + - name: Setup pnpm cache |
| 40 | + uses: actions/cache@v3 |
| 41 | + with: |
| 42 | + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} |
| 43 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 44 | + restore-keys: | |
| 45 | + ${{ runner.os }}-pnpm-store- |
| 46 | +
|
| 47 | + - name: Install dependencies |
| 48 | + run: pnpm install --frozen-lockfile --no-optional |
| 49 | + |
| 50 | + - run: xvfb-run -a pnpm test |
| 51 | + if: runner.os == 'Linux' |
| 52 | + - run: pnpm test |
| 53 | + if: runner.os != 'Linux' |
| 54 | + |
| 55 | + publish: |
| 56 | + needs: test |
| 57 | + if: startsWith(github.ref, 'refs/tags/v') |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - name: Checkout |
| 61 | + uses: actions/checkout@v3 |
| 62 | + |
| 63 | + - name: Install Node.js |
| 64 | + uses: actions/setup-node@v3 |
| 65 | + with: |
| 66 | + node-version: 18.x |
| 67 | + |
| 68 | + - name: Install pnpm |
| 69 | + uses: pnpm/action-setup@v2 |
| 70 | + id: pnpm-install |
| 71 | + with: |
| 72 | + version: 8 |
| 73 | + run_install: false |
| 74 | + |
| 75 | + - name: Get pnpm store directory |
| 76 | + id: pnpm-cache |
| 77 | + shell: bash |
| 78 | + run: | |
| 79 | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT |
| 80 | +
|
| 81 | + - name: Setup pnpm cache |
| 82 | + uses: actions/cache@v3 |
| 83 | + with: |
| 84 | + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} |
| 85 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 86 | + restore-keys: | |
| 87 | + ${{ runner.os }}-pnpm-store- |
| 88 | +
|
| 89 | + - name: Install dependencies |
| 90 | + run: pnpm install --frozen-lockfile --no-optional |
| 91 | + |
| 92 | + - name: Publish to Visual Studio Marketplace |
| 93 | + run: pnpm run publish:vs-marketplace |
| 94 | + env: |
| 95 | + VSCE_PAT: ${{ secrets.VS_MARKETPLACE_TOKEN }} |
| 96 | + |
| 97 | + - name: Publish to Open VSX Registry |
| 98 | + run: pnpm run publish:open-vsx -p ${{ secrets.OPEN_VSX_TOKEN }} |
| 99 | + |
| 100 | + release: |
| 101 | + needs: publish |
| 102 | + if: startsWith(github.ref, 'refs/tags/v') |
| 103 | + runs-on: ubuntu-latest |
| 104 | + steps: |
| 105 | + - uses: actions/checkout@v3 |
| 106 | + with: |
| 107 | + fetch-depth: 0 |
| 108 | + |
| 109 | + - name: Set node |
| 110 | + uses: actions/setup-node@v3 |
| 111 | + with: |
| 112 | + node-version: lts/* |
| 113 | + |
| 114 | + - run: npx changelogithub |
| 115 | + env: |
| 116 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
0 commit comments