Skip to content

Version Packages (#113) #190

Version Packages (#113)

Version Packages (#113) #190

Workflow file for this run

name: CI/CD Workflow
# This workflow gets triggered on pull requests and pushes to the main branch
on:
pull_request:
branches:
- main
push:
branches:
- main
# Ensure that only one instance of the workflow runs at a time
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
build-and-test:
# This job runs on the latest version of Ubuntu
runs-on: ubuntu-latest
steps:
# This step checks out a copy of the repository
- uses: actions/checkout@v2
# This step sets up Node.js on the runner
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 18
# This step installs all of the dependencies for the project
- name: Install Dependencies
run: npm ci
# This step verifies code with ESLint
- name: Run ESLint
run: npm run lint:check
# This step verifies code formatting with Prettier
- name: Run Prettier
run: npm run prettier:check
# This step installs the necessary browsers for Playwright test runner
- name: Install Playwright Browsers
run: npx playwright install
# This step runs the test script
- name: Test
run: npm test
- name: Build
run: npm run build
release:
# This job also runs on the latest version of Ubuntu
runs-on: ubuntu-latest
# This job needs the build-and-test job to complete successfully before it can start
needs: build-and-test
# This job only runs on pushes to the main branch
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# These permissions are needed for creating release pull requests and pushing to npm
permissions:
contents: write
pull-requests: write
steps:
# This step checks out a copy of the repository
- uses: actions/checkout@v2
# This step sets up Node.js on the runner
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 18
# This step installs all of the dependencies for the project
- name: Install Dependencies
run: npm ci
# This step handles versioning and creates a release pull request or publishes to npm
- name: Create Release Pull Request / Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Token used to create release pull request
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Token used to publish to npm