Merge pull request #163 from Tradeshift/renovate/tradeshift-scripts-4.x #176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |