summaryrefslogtreecommitdiffstats
path: root/.github/workflows/cd.yml
blob: 01c207e2d20920a2327e2fdd3fe969f0202ff046 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Release

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  release:
    types:
      - created

jobs:
  pipeline:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Use Node.js
        uses: actions/setup-node@v1
        with:
          node-version: '15.11.0'
      - run: yarn

      - name: Install VSCE
        run: yarn add vsce ovsx -D

      - name: Update $PATH
        run: echo "$PWD/node_modules/.bin/" >> $GITHUB_PATH

      - name: Build vsix
        run: vsce package && ls -alh

      - name: Publish to VS Code Marketplace
        run: vsce publish -p ${VSCE_TOKEN}
        env:
          VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
        if: contains(github.ref, 'refs/tags/')

      - name: Publish to Open VSX Registry
        run: ovsx publish
        env:
          OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }}
        if: contains(github.ref, 'refs/tags/')

      - name: Upload vsix to GitHub release
        uses: svenstaro/upload-release-action@v2
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          file: doxdocgen-*.vsix
          tag: ${{ github.ref }}
          overwrite: true
          file_glob: true
        if: contains(github.ref, 'refs/tags/')