Skip to content

fix: dark mode variant, button contrast, and CountryCodeDropdown import #31

fix: dark mode variant, button contrast, and CountryCodeDropdown import

fix: dark mode variant, button contrast, and CountryCodeDropdown import #31

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*' # Stable and prerelease tags, e.g. v1.0.0 or v1.0.0-beta.1
branches:
- main # Auto dev-prerelease on every main push
paths-ignore:
- '*.md'
- '.github/**'
- '!.github/workflows/release.yml'
permissions:
contents: write
id-token: write # Required for npm Trusted Publishing (OIDC)
jobs:
release:
name: Build and Publish
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Type check
run: pnpm typecheck
- name: Run unit tests
run: pnpm test
- name: Build package
run: pnpm build
env:
NODE_OPTIONS: '--max-old-space-size=8192'
- name: Determine release info
id: release-info
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
# Tag-based release (stable or tagged prerelease)
VERSION=${GITHUB_REF#refs/tags/v}
IS_TAG=true
if [[ "$VERSION" == *"-"* ]]; then
NPM_TAG=next
IS_PRERELEASE=true
else
NPM_TAG=latest
IS_PRERELEASE=false
fi
else
# Branch push — auto dev prerelease
BASE_VERSION=$(node -p "require('./package.json').version" | sed 's/-.*//')
VERSION="${BASE_VERSION}-dev.${GITHUB_RUN_NUMBER}"
IS_TAG=false
NPM_TAG=next
IS_PRERELEASE=true
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "npm_tag=$NPM_TAG" >> $GITHUB_OUTPUT
echo "is_tag=$IS_TAG" >> $GITHUB_OUTPUT
echo "is_prerelease=$IS_PRERELEASE" >> $GITHUB_OUTPUT
echo "IS_TAG=$IS_TAG version=$VERSION npm_tag=$NPM_TAG"
- name: Set package version
run: |
VERSION="${{ steps.release-info.outputs.version }}"
node -e "const fs=require('fs'),p=JSON.parse(fs.readFileSync('./package.json'));p.version='$VERSION';fs.writeFileSync('./package.json',JSON.stringify(p,null,2)+'\n')"
- name: Publish to npm
# Trusted Publishing: OIDC token is obtained automatically via id-token permission.
# No NPM_PUBLISH_SECRET token is needed or used.
run: pnpm publish --access public --provenance --tag ${{ steps.release-info.outputs.npm_tag }} --no-git-checks
- name: Create GitHub Release
if: steps.release-info.outputs.is_tag == 'true'
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
prerelease: ${{ steps.release-info.outputs.is_prerelease == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Summary
run: |
echo "## 📦 Published to npm" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** \`${{ steps.release-info.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
echo "**npm tag:** \`${{ steps.release-info.outputs.npm_tag }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [[ "${{ steps.release-info.outputs.npm_tag }}" == "next" ]]; then
echo "Install with: \`npm install @mieweb/ui@next\`" >> $GITHUB_STEP_SUMMARY
else
echo "Install with: \`npm install @mieweb/ui\`" >> $GITHUB_STEP_SUMMARY
fi