Skip to content

docs(release): restore alpha publishing and docs deployment [Codex] #1

docs(release): restore alpha publishing and docs deployment [Codex]

docs(release): restore alpha publishing and docs deployment [Codex] #1

Workflow file for this run

name: Release
on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
dry_run:
description: Run npm publish without publishing the package
required: true
default: true
type: boolean
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: "24"
registry-url: https://registry.npmjs.org
package-manager-cache: false
- name: Install dependencies
run: npm ci
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
- name: Get short commit hash
id: vars
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Update package version to -<commit-hash>
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}-alpha-${{ env.COMMIT_HASH }}
run: |
node <<'NODE'
const fs = require("node:fs");
const packageJsonPath = "package.json";
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
packageJson.version = process.env.PACKAGE_VERSION;
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
NODE
- name: Package npm package
run: npm pack
- name: Dry-run npm publish
if: github.event_name == 'pull_request' || inputs.dry_run
run: npm publish ./rescript-webapi-*.tgz --access public --tag alpha --dry-run
- name: Publish npm package
if: github.event_name == 'workflow_dispatch' && !inputs.dry_run
run: npm publish ./rescript-webapi-*.tgz --access public --tag alpha