|
| 1 | +name: main |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + ci: |
| 6 | + runs-on: ${{ matrix.os }} |
| 7 | + env: |
| 8 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + os: [ubuntu-18.04, macos-10.15, windows-2019] |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@master |
| 14 | + - uses: actions/setup-node@master |
| 15 | + with: |
| 16 | + node-version: "10.19.0" |
| 17 | + - run: npm ci |
| 18 | + - run: npm run build |
| 19 | + - run: npm run tslint |
| 20 | + - run: npm run test |
| 21 | + - run: npm run publish-coverage |
| 22 | + npm-release: |
| 23 | + #only run this task if a tag starting with 'v' was used to trigger this (i.e. a tagged release) |
| 24 | + if: startsWith(github.ref, 'refs/tags/v') |
| 25 | + needs: ci |
| 26 | + runs-on: ubuntu-18.04 |
| 27 | + env: |
| 28 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@master |
| 32 | + - uses: actions/setup-node@master |
| 33 | + with: |
| 34 | + node-version: "10.19.0" |
| 35 | + - run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ./.npmrc |
| 36 | + - run: npm ci |
| 37 | + - run: npm run build |
| 38 | + |
| 39 | + #create npm package |
| 40 | + - run: npm package |
| 41 | + |
| 42 | + #compute release version |
| 43 | + - name: Compute release version |
| 44 | + run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF##*/v} |
| 45 | + |
| 46 | + #create GitHub release |
| 47 | + - name: Create GitHub Release |
| 48 | + id: create_release |
| 49 | + uses: actions/create-release@latest |
| 50 | + with: |
| 51 | + tag_name: ${{ github.ref }} |
| 52 | + release_name: ${{ github.ref }} |
| 53 | + draft: false |
| 54 | + prerelease: false #contains(github.ref, '-beta.') == true |
| 55 | + |
| 56 | + #upload package to GitHub release |
| 57 | + - name: Upload vsix to GitHub release |
| 58 | + uses: AButler/upload-release-assets@v2.0 |
| 59 | + with: |
| 60 | + files: '*.tgz' |
| 61 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + release-tag: v${{ env.RELEASE_VERSION }} |
| 63 | + |
| 64 | + #upload to npm |
| 65 | + - run: npm publish |
0 commit comments