diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 510f272..1575548 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,36 +1,9 @@ name: Build & Publish Package on: - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - inputs: - version: - description: "Version to publish" - required: true - type: string - # Default to truncated commit hash - default: "0.0.0" - tag: - description: "Tag to publish" - required: true - type: string - default: "latest" - package: - description: "Package to publish" - options: - - federation - - client - type: choice - required: true - registry: - description: "Registry to publish to" - required: true - type: choice - options: - - npm - - jsr - - both - default: "both" + push: + branches: + - main permissions: contents: read @@ -38,10 +11,10 @@ permissions: id-token: write jobs: - # Build job - build: + publish: runs-on: ubuntu-latest environment: NPM Deploy + if: contains(github.event.head_commit.message, '[publish') steps: - name: Checkout uses: actions/checkout@v4 @@ -56,15 +29,22 @@ jobs: - name: Build run: bun install && bun run build - - name: Change version in package.json to ${{ github.event.inputs.version }} - run: 'sed -i ''s/"version": ".*"/"version": "${{ github.event.inputs.version }}"/'' package.json ${{ github.event.inputs.package }}/package.json ${{ github.event.inputs.package }}/jsr.jsonc' + - name: Publish Federation to NPM + if: contains(github.event.head_commit.message, '(federation)') + run: cd federation && npm publish --provenance --tag ${{ contains(github.event.head_commit.message, '[publish nightly]') && 'nightly' || 'latest' }} --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish Federation to JSR + if: contains(github.event.head_commit.message, '(federation)') + run: cd federation && bunx jsr publish --allow-slow-types --allow-dirty - - name: Publish to NPM - if: ${{ github.event.inputs.registry == 'npm' }} || ${{ github.event.inputs.registry == 'both' }} - run: cd ${{ github.event.inputs.package }} && npm publish --provenance --tag ${{ github.event.inputs.tag }} --access public + - name: Publish Client to NPM + if: contains(github.event.head_commit.message, '(client)') + run: cd client && npm publish --provenance --tag ${{ contains(github.event.head_commit.message, '[publish nightly]') && 'nightly' || 'latest' }} --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Publish to JSR - if: ${{ github.event.inputs.registry == 'jsr' }} || ${{ github.event.inputs.registry == 'both' }} - run: cd ${{ github.event.inputs.package }} && bun install --frozen-lockfile && bunx jsr publish --allow-slow-types --allow-dirty + - name: Publish Client to JSR + if: contains(github.event.head_commit.message, '(client)') + run: cd client && bunx jsr publish --allow-slow-types --allow-dirty diff --git a/client/jsr.jsonc b/client/jsr.jsonc index d2935cd..6d78d71 100644 --- a/client/jsr.jsonc +++ b/client/jsr.jsonc @@ -1,7 +1,7 @@ { "$schema": "https://jsr.io/schema/config-file.v1.json", "name": "@versia/client", - "version": "0.0.0", + "version": "0.0.1-alpha.1", "exports": { ".": "./index.ts", "./types": "./types.ts" diff --git a/client/package.json b/client/package.json index cb70c0d..dab98e5 100644 --- a/client/package.json +++ b/client/package.json @@ -1,7 +1,7 @@ { "name": "@versia/client", "displayName": "Versia Client", - "version": "0.0.0", + "version": "0.0.1-alpha.1", "author": { "email": "jesse.wierzbinski@lysand.org", "name": "Jesse Wierzbinski (CPlusPatch)", diff --git a/federation/jsr.jsonc b/federation/jsr.jsonc index 2e64c1a..2a21bfb 100644 --- a/federation/jsr.jsonc +++ b/federation/jsr.jsonc @@ -1,7 +1,7 @@ { "$schema": "https://jsr.io/schema/config-file.v1.json", "name": "@versia/federation", - "version": "0.0.0", + "version": "0.0.1-alpha.1", "exports": { ".": "./index.ts", "./types": "./schemas.ts" diff --git a/federation/package.json b/federation/package.json index 4e0ba18..9f1ee65 100644 --- a/federation/package.json +++ b/federation/package.json @@ -1,7 +1,7 @@ { "name": "@versia/federation", "displayName": "Versia Federation", - "version": "0.0.0", + "version": "0.0.1-alpha.1", "author": { "email": "jesse.wierzbinski@lysand.org", "name": "Jesse Wierzbinski (CPlusPatch)",