Skip to content

Merge pull request #168 from Tradeshift/renovate/actions-checkout-4.x #153

Merge pull request #168 from Tradeshift/renovate/actions-checkout-4.x

Merge pull request #168 from Tradeshift/renovate/actions-checkout-4.x #153

Workflow file for this run

name: Test & release
on:
pull_request:
push:
branches:
- master
- main
jobs:
test:
name: npm test
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node: [14, 16]
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: βŽ” Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: "npm"
- name: πŸ“₯ Download deps
run: npm ci
- name: ▢️ Run tests
run: npm run validate
- name: Upload code coverage
uses: tradeshift/actions-coverage-upload@master
if: ${{ github.ref == 'refs/heads/master' }}
continue-on-error: true
with:
file: coverage/cobertura-coverage.xml
name: ${{ github.event.repository.name }}
ca-cert: ${{ secrets.MTLS_CACERT }}
client-cert: ${{ secrets.MTLS_CERT }}
client-key: ${{ secrets.MTLS_KEY }}
release:
name: πŸš€ Release
needs: [test]
runs-on: ubuntu-latest
if: ${{ !github.event.fork &&
contains('refs/heads/master,refs/heads/main', github.ref) && github.event_name == 'push' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: βŽ” Setup node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: πŸ“₯ Download deps
run: npm ci
- name: πŸ— Run build script
run: npm run --if-present build
- name: πŸš€ Release (github registry)
uses: tradeshift/actions-semantic-release@v1
id: semantic-release
with:
registry: https://npm.pkg.github.com/
npm_publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: βŽ” Setup node (npm registry)
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.com
cache: npm
- name: πŸš€ Release (npm registry)
run: npm publish --registry https://registry.npmjs.com
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN_PUBLIC }}