Skip to content

Commit

Permalink
Merge pull request #2 from vyrnnstudios/chore/gh-actions
Browse files Browse the repository at this point in the history
chore: create github action to release this package  @gutyerrez
  • Loading branch information
gutyerrez authored Dec 27, 2023
2 parents ae14ec0 + a7a56ab commit 7588238
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/releases.yaml
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 }}

0 comments on commit 7588238

Please sign in to comment.