Skip to content

Commit

Permalink
adding publish and build script
Browse files Browse the repository at this point in the history
  • Loading branch information
niclasheun committed Jan 15, 2025
1 parent 05a14bf commit 6f44595
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/build-and-publish-state.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build and Publish Yarn Package

# Trigger workflow on pushes of version tags (e.g. "v1.0.0")
on:
pull_request:
branches: [main]

jobs:
publish:
runs-on: ubuntu-latest
steps:
# Check out the repository
- name: Checkout repository
uses: actions/checkout@v4

# Set up Node.js with Yarn, caching Yarn dependencies.

- name: Use Node.js
working-directory: ./prompt-shared-state
uses: actions/setup-node@v4
with:
node-version: '23.x'

- name: Install dependencies
working-directory: ./prompt-shared-state
run: yarn --frozen-lockfile

- name: Build package
working-directory: ./prompt-shared-state
run: yarn build
35 changes: 35 additions & 0 deletions .github/publish-state-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Package to github
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
# Check out the repository
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-node@v4
working-directory: ./prompt-shared-state
with:
node-version: '23.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@ls1tum'

- name: Install dependencies
working-directory: ./prompt-shared-state
run: yarn --frozen-lockfile

- name: Build package
working-directory: ./prompt-shared-state
run: yarn build

- run: yarn npm publish
working-directory: ./prompt-shared-state
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion prompt-shared-state/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "prompt-shared-state",
"name": "@ls1tum/prompt-shared-state",
"version": "0.0.1",
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"main": "./dist/esm/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
Expand Down

0 comments on commit 6f44595

Please sign in to comment.