Skip to content

Commit

Permalink
Set up the publish GitHub action with release-it
Browse files Browse the repository at this point in the history
  • Loading branch information
9inpachi committed Sep 8, 2024
1 parent ee803a3 commit 9093706
Show file tree
Hide file tree
Showing 4 changed files with 2,115 additions and 5 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: publish-package

on:
workflow_dispatch:
inputs:
increment:
type: choice
description: Version increment (defaults to minor)
default: minor
options:
- major
- minor
- patch
- premajor
- preminor
- prepatch
prerelease:
type: choice
description: Make the release a beta or alpha prerelease
default: "no"
options:
- "no"
- beta
- alpha

jobs:
publish-package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: latest
run_install: true

- name: Setup git
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Build package
run: pnpm build

- name: Publish package
if: "${{ inputs.prerelease == 'no' || inputs.prerelease == '' }}"
run: pnpm release --increment ${{ inputs.increment }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Prepublish package
if: "${{ inputs.prerelease != 'no' && inputs.prerelease != '' }}"
run: pnpm release ${{ inputs.increment }} --preRelease ${{ inputs.prerelease }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "three-panorama-controls",
"version": "1.0.0",
"version": "0.0.0",
"description": "Panorama controls for three.js.",
"author": "Fawad Ali <[email protected]>",
"license": "Apache-2.0",
Expand Down Expand Up @@ -47,7 +47,8 @@
"build": "pnpm clean && pnpm build:cjs && pnpm build:esm && pnpm build:types",
"build:cjs": "pnpm tsc --project ./tsconfig.cjs.json --outDir ./dist/cjs/ --declaration false",
"build:esm": "pnpm tsc --project ./tsconfig.esm.json --outDir ./dist/esm/ --declaration false",
"build:types": "pnpm tsc --emitDeclarationOnly true --declarationDir ./dist/types"
"build:types": "pnpm tsc --emitDeclarationOnly true --declarationDir ./dist/types",
"release": "release-it"
},
"peerDependencies": {
"@react-three/fiber": ">= 8",
Expand All @@ -61,6 +62,7 @@
"@types/three": "^0.168.0",
"eslint": "^9.10.0",
"globals": "^15.9.0",
"release-it": "^17.6.0",
"typescript": "^5.5.4",
"typescript-eslint": "^8.4.0"
},
Expand Down
Loading

0 comments on commit 9093706

Please sign in to comment.