diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..65dfc565cff --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: Kubernetes Javascript Client + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + validation: + runs-on: ubuntu-latest + strategy: + matrix: + node: [ '16', '14', '12' ] + name: Node ${{ matrix.node }} validation + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + # Pre-check to validate that versions match between package.json + # and package-lock.json. Needs to run before npm install + - run: node version-check.js + - run: npm ci + - run: npm test + - run: npm run lint + - run: npm audit --audit-level=critical + release-package: + name: Release Package + runs-on: ubuntu-latest + needs: validation + steps: + - name: Checkout + uses: actions/checkout@v2.3.1 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '14.x' + # Pre-check to validate that versions match between package.json + # and package-lock.json. Needs to run before npm install + - name: Validate package.json and package-lock.json versions + run: node version-check.js + - name: Install dependencies + run: npm ci + - name: Publish package + id: publish + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} + dry-run: github.event_name == 'pull_request' + - name: Check if version was already published + uses: actions/github-script@v5 + with: + script: | + if(${{ steps.publish.outputs.type == 'none' }}) { + core.setFailed('Version ${{ steps.publish.outputs.old-version }} was already published') + } diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 86034dbe4d9..00000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Kubernetes Javascript Client - Validation - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - node: [ '16', '14', '12' ] - name: Node ${{ matrix.node }} validation - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - # Pre-check to validate that versions match between package.json - # and package-lock.json. Needs to run before npm install - - run: node version-check.js - - run: npm ci - - run: npm test - - run: npm run lint - - run: npm audit --audit-level=critical -