-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from vyrnnstudios/chore/gh-actions
chore: create github action to release this package @gutyerrez
- Loading branch information
Showing
1 changed file
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Publish package to registry | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to publish' | ||
default: '1.0.0' | ||
required: true | ||
release: | ||
types: | ||
- released | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# | ||
# Checkout repository | ||
# | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# | ||
# Setup Node.js | ||
# | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
# | ||
# Setup PNPM package manager | ||
# | ||
- name: Setup package manager | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
# | ||
# Install all dependencies | ||
# | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
# | ||
# Build package and generate javascript files | ||
# | ||
- name: Build package | ||
run: pnpm build | ||
|
||
# | ||
# Configure git user email | ||
# | ||
- if: github.event_name == 'release' | ||
name: Configure git user email | ||
run: git config --global user.email "${{ github.event.release.author.email }}" | ||
|
||
- if: github.event_name == 'workflow_dispatch' | ||
name: Configure git user email | ||
run: git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
|
||
# | ||
# Configure git user name | ||
# | ||
- if: github.event_name == 'release' | ||
name: Configure git user name | ||
run: git config --global user.name "${{ github.event.release.author.login }}" | ||
|
||
- if: github.event_name == 'workflow_dispatch' | ||
name: Configure git user name | ||
run: git config --global user.name "${{ github.actor }}" | ||
|
||
# | ||
# Change package version | ||
# | ||
- if: github.event_name == 'release' | ||
name: Change package version | ||
run: pnpm version ${{ github.event.release.tag_name }} | ||
|
||
- if: github.event_name == 'workflow_dispatch' | ||
name: Change package version | ||
run: pnpm version ${{ github.event.inputs.version }} | ||
|
||
# | ||
# Publish package to destination registry | ||
# | ||
# - name: Publish package to registry | ||
# run: pnpm publish | ||
# env: | ||
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |