Skip to content

Release

Release #50

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
release_type:
description: 'Release type'
required: true
default: 'production'
type: choice
options:
- production
- dev
dry_run:
description: 'Dry run (production releases only)'
required: false
default: false
type: boolean
npm_tag:
description: 'NPM dist tag (dev releases only, also used as version suffix)'
required: false
default: 'dev'
type: choice
options:
- dev
- next
- alpha
- beta
- canary
- nightly
custom_npm_tag:
description: 'Custom NPM tag (dev releases only, overrides selection above, e.g., v4.1.x)'
required: false
type: string
# Remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions: {}
jobs:
# Production release job - runs semantic-release for automated versioning
production-release:
if: inputs.release_type == 'production'
name: Production Release
concurrency:
group: release-production
cancel-in-progress: false
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: 🔍 Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- name: 🔧 Setup environment
run: corepack enable
- name: 📦 Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 24.10.0
registry-url: 'https://registry.npmjs.org/'
cache: 'pnpm'
- name: 🔄 Update npm for trusted publishing
run: npm install -g npm@11.6.0
- name: 🔧 Configure registries
run: |
pnpm config set registry https://registry.npmjs.org
npm config set registry https://registry.npmjs.org
- name: 📦 Install dependencies
run: pnpm install
- name: 🛠 Build package
run: pnpm build
- name: 🚀 Run semantic-release
if: ${{ !inputs.dry_run }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm release
- name: Dry run semantic-release
if: ${{ inputs.dry_run }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm release --dry-run
# Dev/Nightly release job - manual versioning with custom npm tag
dev-release:
if: inputs.release_type == 'dev'
name: Dev Release
concurrency:
group: release-dev-${{ inputs.npm_tag }}
cancel-in-progress: false
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: 🔍 Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- name: 🔧 Setup environment
run: corepack enable
- name: 📦 Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 24.10.0
registry-url: 'https://registry.npmjs.org/'
cache: 'pnpm'
- name: 🔄 Update npm for trusted publishing
run: npm install -g npm@11.6.0
- name: 🔧 Configure registries
run: |
pnpm config set registry https://registry.npmjs.org
npm config set registry https://registry.npmjs.org
- name: 📦 Install dependencies
run: pnpm install
- name: 🛠 Build package
run: pnpm build
- name: 🏷️ Generate dev version
id: version
run: |
COMMIT_SHA=$(git rev-parse --short HEAD)
TIMESTAMP=$(date +%Y%m%d%H%M%S)
CURRENT_VERSION=$(node -p "require('./package.json').version")
NPM_TAG="${{ inputs.custom_npm_tag || inputs.npm_tag }}"
# Generate version based on tag
if [ "${NPM_TAG}" = "nightly" ]; then
DEV_VERSION="${CURRENT_VERSION}-nightly.${TIMESTAMP}"
else
DEV_VERSION="${CURRENT_VERSION}-${NPM_TAG}.${TIMESTAMP}.${COMMIT_SHA}"
fi
echo "version=${DEV_VERSION}" >> $GITHUB_OUTPUT
echo "npm_tag=${NPM_TAG}" >> $GITHUB_OUTPUT
echo "📦 Publishing version: ${DEV_VERSION} with tag: ${NPM_TAG}"
- name: 📝 Update package.json version
run: |
npm version ${{ steps.version.outputs.version }} --no-git-tag-version
cd packages/vitest-environment-stencil
npm version ${{ steps.version.outputs.version }} --no-git-tag-version
- name: 🚀 Publish to npm
run: |
pnpm publish --tag ${{ steps.version.outputs.npm_tag }} --access public --provenance --no-git-checks
cd packages/vitest-environment-stencil
pnpm publish --tag ${{ steps.version.outputs.npm_tag }} --access public --provenance --no-git-checks
- name: 🏷️ Create git tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"
- name: ✅ Summary
run: |
echo "## 🎉 Dev Release Published" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Version:** \`${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
echo "- **NPM Tag:** \`${{ steps.version.outputs.npm_tag }}\`" >> $GITHUB_STEP_SUMMARY
echo "- **Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Install with:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
echo "npm install @stencil/vitest@${{ steps.version.outputs.npm_tag }}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY