Skip to content

Commit

Permalink
feat: add create-release action using changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed Jul 15, 2023
1 parent e29aa6b commit 9eb0c8d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 2 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/create-changesets-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Create release or publish to pnpm reusable workflow
on:
workflow_call:
inputs:
os:
description: The operating system to run the workflow on
required: false
type: string
default: ubuntu-latest
node:
description: The node version to use when creating the release
required: false
type: string
default: 18
repository:
description: The repository to use when creating the release
required: true
type: string
secrets:
github_token:
required: true
npm_token:
required: true

jobs:
release:
if: ${{ github.repository == inputs.repository && contains('refs/heads/master', github.ref)}}
runs-on: ${{ inputs.os }}

steps:
- name: 📦 Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ⚙️ Setup node ${{ inputs.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node }}
registry-url: 'https://registry.npmjs.org/'

- name: 📥 Monorepo install
uses: wayofdev/gh-actions/actions/pnpm-install@master
with:
enable-corepack: false
cache-node-modules: true

- name: 🦋 Create release pull request or publish to npm
id: changesets
uses: changesets/action@v1
with:
commit: 'chore: update versions'
title: 'chore: update versions'
cwd: ${{ github.workspace }}
publish: pnpm run cs:publish
version: pnpm run cs:version
setupGitUser: true
env:
HOME: ${{ github.workspace }}
GITHUB_TOKEN: ${{ secrets.github_token }}
NPM_TOKEN: ${{ secrets.npm_token }}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ repos:
- id: fix-encoding-pragma

- repo: https://github.com/commitizen-tools/commitizen
rev: 3.2.2
rev: 3.5.3
hooks:
- id: commitizen
stages:
- commit-msg

- repo: https://github.com/mpalmer/action-validator
rev: v0.5.1
rev: v0.5.3
hooks:
- id: action-validator
stages:
Expand Down

0 comments on commit 9eb0c8d

Please sign in to comment.