Skip to content

Commit

Permalink
feat(ci): setup basic ci pipeline for releasing package
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenWesterlaken committed Apr 1, 2024
1 parent 09ebad4 commit ad66c1f
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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 }}

0 comments on commit ad66c1f

Please sign in to comment.