Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚧 dev: add alpha release script #1656

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release (Alpha)
on:
workflow_dispatch:
inputs:
preid:
description: 'Pre-release identifier (e.g., alpha.1)'
required: true
type: string
dry_run:
description: 'Dry run (no actual publish)'
type: boolean
default: false

jobs:
alpha:
name: Release alpha
runs-on: ubuntu-latest
# Require explicit environment approval
environment:
name: alpha-release
url: https://www.npmjs.com/package/@coinbase/onchainkit
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: 'Setup'
uses: ./.github/actions/setup

- name: Set version
run: |
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]')
npm --no-git-tag-version version $(npm pkg get version | sed 's/"//g')-${BRANCH_NAME}.$(echo ${{ github.event.inputs.preid }})

- name: Build
shell: bash
run: yarn build

- name: Test package
if: ${{ inputs.dry_run }}
run: npm publish --dry-run --tag alpha

- name: Set deployment token
if: ${{ !inputs.dry_run }}
run: npm config set '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}"

- name: Publish to npm
if: ${{ !inputs.dry_run }}
run: npm publish --tag alpha
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}