mirror of
https://github.com/versia-pub/api.git
synced 2025-12-06 08:28:19 +01:00
ci: 👷 Rework CI deploy process
This commit is contained in:
parent
f65cfe4c9a
commit
e9fe689c39
62
.github/workflows/publish.yml
vendored
62
.github/workflows/publish.yml
vendored
|
|
@ -1,36 +1,9 @@
|
||||||
name: Build & Publish Package
|
name: Build & Publish Package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
push:
|
||||||
workflow_dispatch:
|
branches:
|
||||||
inputs:
|
- main
|
||||||
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"
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
@ -38,10 +11,10 @@ permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Build job
|
publish:
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: NPM Deploy
|
environment: NPM Deploy
|
||||||
|
if: contains(github.event.head_commit.message, '[publish')
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -56,15 +29,22 @@ jobs:
|
||||||
- name: Build
|
- name: Build
|
||||||
run: bun install && bun run build
|
run: bun install && bun run build
|
||||||
|
|
||||||
- name: Change version in package.json to ${{ github.event.inputs.version }}
|
- name: Publish Federation to NPM
|
||||||
run: 'sed -i ''s/"version": ".*"/"version": "${{ github.event.inputs.version }}"/'' package.json ${{ github.event.inputs.package }}/package.json ${{ github.event.inputs.package }}/jsr.jsonc'
|
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
|
||||||
- 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
|
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
- name: Publish to JSR
|
- name: Publish Federation to JSR
|
||||||
if: ${{ github.event.inputs.registry == 'jsr' }} || ${{ github.event.inputs.registry == 'both' }}
|
if: contains(github.event.head_commit.message, '(federation)')
|
||||||
run: cd ${{ github.event.inputs.package }} && bun install --frozen-lockfile && bunx jsr publish --allow-slow-types --allow-dirty
|
run: cd federation && bunx jsr publish --allow-slow-types --allow-dirty
|
||||||
|
|
||||||
|
- 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 Client to JSR
|
||||||
|
if: contains(github.event.head_commit.message, '(client)')
|
||||||
|
run: cd client && bunx jsr publish --allow-slow-types --allow-dirty
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://jsr.io/schema/config-file.v1.json",
|
"$schema": "https://jsr.io/schema/config-file.v1.json",
|
||||||
"name": "@versia/client",
|
"name": "@versia/client",
|
||||||
"version": "0.0.0",
|
"version": "0.0.1-alpha.1",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./index.ts",
|
".": "./index.ts",
|
||||||
"./types": "./types.ts"
|
"./types": "./types.ts"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@versia/client",
|
"name": "@versia/client",
|
||||||
"displayName": "Versia Client",
|
"displayName": "Versia Client",
|
||||||
"version": "0.0.0",
|
"version": "0.0.1-alpha.1",
|
||||||
"author": {
|
"author": {
|
||||||
"email": "jesse.wierzbinski@lysand.org",
|
"email": "jesse.wierzbinski@lysand.org",
|
||||||
"name": "Jesse Wierzbinski (CPlusPatch)",
|
"name": "Jesse Wierzbinski (CPlusPatch)",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://jsr.io/schema/config-file.v1.json",
|
"$schema": "https://jsr.io/schema/config-file.v1.json",
|
||||||
"name": "@versia/federation",
|
"name": "@versia/federation",
|
||||||
"version": "0.0.0",
|
"version": "0.0.1-alpha.1",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./index.ts",
|
".": "./index.ts",
|
||||||
"./types": "./schemas.ts"
|
"./types": "./schemas.ts"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@versia/federation",
|
"name": "@versia/federation",
|
||||||
"displayName": "Versia Federation",
|
"displayName": "Versia Federation",
|
||||||
"version": "0.0.0",
|
"version": "0.0.1-alpha.1",
|
||||||
"author": {
|
"author": {
|
||||||
"email": "jesse.wierzbinski@lysand.org",
|
"email": "jesse.wierzbinski@lysand.org",
|
||||||
"name": "Jesse Wierzbinski (CPlusPatch)",
|
"name": "Jesse Wierzbinski (CPlusPatch)",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue