Skip to content

Commit

Permalink
chore: setup workflow_dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan authored Aug 17, 2022
1 parent 300e219 commit 300a931
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 13 deletions.
49 changes: 36 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,50 @@
name: CI
name: CI & Release
on:
- push
- pull_request
push:
workflow_dispatch:
inputs:
release:
description: 'Release new version'
required: true
default: false
type: boolean
jobs:
test:
runs-on: ${{ matrix.platform }}
name: Node.js ${{ matrix.node-version }} / ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
node-version:
- 16
platform: [ubuntu-latest, macos-latest]
node-version: [lts/*, current]
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run lint
- run: npm run build
#- run: npm test
- run: npm test

release:
name: 'Semantic release'
needs: test
runs-on: ubuntu-latest
if: inputs.release == true
steps:
- uses: actions/checkout@v3
with:
# Need to fetch entire commit history to
# analyze every commit since last release
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'npm'
- run: npm install
# Branches that will release new versions are defined in .releaserc.json
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
4 changes: 4 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@sanity/semantic-release-preset",
"branches": ["master"]
}

0 comments on commit 300a931

Please sign in to comment.