Skip to content

[CI] publish infrastructure for "latest" #283

[CI] publish infrastructure for "latest"

[CI] publish infrastructure for "latest" #283

Workflow file for this run

# inspired from https://github.com/eclipse-theia/theia-cpp-extensions/raw/master/.github/workflows/ci-cd.yml
# and https://github.com/eclipse-cdt-cloud/theia-trace-extension/raw/master/.github/workflows/build.yml
name: CI-CD
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build-and-test:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [18]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Build
shell: bash
# Note: `yarn build` is done as part of `yarn install` already.
run: |
yarn install --frozen-lockfile
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9
- name: Test
shell: bash
run: |
yarn test --verbose
publish-next:
name: Publish 'next' package to npm
needs: build-and-test
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository == 'eclipse-cdt-cloud/tsp-typescript-client'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- run: yarn --frozen-lockfile
- name: Publish 'next'
uses: nick-invision/retry@v3
with:
timeout_minutes: 5
retry_wait_seconds: 60
max_attempts: 3
retry_on: error
command: yarn publish:next
env:
# The variable name comes from here:
# https://github.com/actions/setup-node/blob/70b9252472eee7495c93bb1588261539c3c2b98d/src/authutil.ts#L48
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
publish-latest:
name: Publish 'latest' package to npm
needs: build-and-test
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'eclipse-cdt-cloud/tsp-typescript-client'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- run: yarn --frozen-lockfile
- name: Publish 'latest'
uses: nick-invision/retry@v3
with:
timeout_minutes: 5
retry_wait_seconds: 60
max_attempts: 3
retry_on: error
command: yarn publish:latest
env:
# The variable name comes from here:
# https://github.com/actions/setup-node/blob/70b9252472eee7495c93bb1588261539c3c2b98d/src/authutil.ts#L48
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}