Skip to content

feat(ci): setup basic ci pipeline for releasing package #1

feat(ci): setup basic ci pipeline for releasing package

feat(ci): setup basic ci pipeline for releasing package #1

Workflow file for this run

name: release
on:
push:
pull_request:
branches:
- main
jobs:
test-build:
runs-on: ubuntu-latest
strategy:
matrix:
# Run the steps below with the following versions of Node.js
node-version: [16.x, 18.x, 20.x]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
release-dry:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
needs: [test-build]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 20.x
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Release (dry)
run: npm run release:dry
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
# Only release on push to mastmainer
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
# Waits for test jobs for each Node.js version to complete
needs: [test-build]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 20.x
- name: Install
run: npm install
- name: Release
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}