Skip to content

Commit

Permalink
chore: fix release
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Sep 17, 2023
1 parent 329a01e commit 87999bf
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 29 deletions.
81 changes: 53 additions & 28 deletions .github/workflows/release.yml
@@ -1,31 +1,56 @@
name: Release
name: Publish

on: [push]
on:
workflow_dispatch:
inputs:
release-type:
type: choice
description: Type of the release
options:
- patch
- minor
- major

jobs:
release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- uses: actions/checkout@v2

- name: Prepare repository
run: git fetch --unshallow --tags

- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Install dependencies
run: pnpm install

- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pnpm run release
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Install
run: pnpm install

- name: Build
run: pnpm build

- name: Configure github-actions git
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@users.noreply.github.com'
- name: Bump version
run: npm version ${{ github.event.inputs.release-type }}

- name: Generate changelog
run: |
pnpm changelog
git add CHANGELOG.md
git commit -m 'chore: changelog'
- name: Push release tag
run: git push origin master --follow-tags

- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -45,9 +45,9 @@
"scripts": {
"build": "rm -rf ./dist && tsup",
"build:watch": "pnpm run build --watch",
"changelog": "npx conventional-changelog-cli -i CHANGELOG.md -p angular -s -r 0",
"test": "echo \"Error: no test specified\" && exit 1",
"start": "run-p build:watch 'storybook --quiet'",
"prerelease": "zx scripts/prepublish-checks.mjs",
"release": "pnpm run build && auto shipit",
"eject-ts": "zx scripts/eject-typescript.mjs",
"storybook": "storybook dev -p 6006",
Expand Down

0 comments on commit 87999bf

Please sign in to comment.