Skip to content

ci: improve jobs definition #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,39 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
lint-test:
name: 🚀 Lint and test
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
node: [ 18, 20 ]

steps:
- name: 👍 Checkout
uses: actions/checkout@v4

- name: 🐢 Setup node.js
uses: actions/setup-node@v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'

node-version: lts/*
cache: npm
- name: 📥 Install dependencies
run: npm install

- name: 💅 Lint code style
run: npm run lint

- name: ✅ Run tests
run: npm run test

publish:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
name: 📦 Publish
runs-on: ubuntu-latest
needs: lint-test
timeout-minutes: 5
permissions:
# Needed by googleapis/release-please-action@v4
contents: write
pull-requests: write
# Needed by `npm publish --provenance`
id-token: write

steps:
- name: 🍄 Bump package version, create GitHub release, and update changelog
uses: googleapis/release-please-action@v4
Expand All @@ -57,6 +44,7 @@ jobs:
if: ${{ steps.release.outputs.release_created }}
with:
node-version: lts/*
cache: npm
registry-url: https://registry.npmjs.org
- name: 🚀 Publish to npm
if: ${{ steps.release.outputs.release_created }}
Expand Down