Skip to content

fix(ci): pin pnpm@10.6.5 via corepack to fix install failures #71

fix(ci): pin pnpm@10.6.5 via corepack to fix install failures

fix(ci): pin pnpm@10.6.5 via corepack to fix install failures #71

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Release tag (beta or latest)'
required: true
default: 'latest'
type: choice
options:
- latest
- beta
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Enable corepack and install pnpm
run: |
corepack enable
corepack prepare pnpm@10.6.5 --activate
- name: Install dependencies
run: |
rm -rf ~/.npm/_cacache
rm -rf node_modules/.cache
rm -rf packages/core/node_modules
pnpm store prune || true
pnpm install --force
- name: Build
run: |
(cd packages/core && \
pnpm run aeac && \
pnpm run build:es && \
pnpm run build:umd)
- name: Determine release tag
id: tag_type
run: |
VERSION=$(node -p "require('./packages/core/package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
if [[ "$VERSION" == *"beta"* ]] || [[ "${{ github.event.inputs.tag }}" == "beta" ]]; then
echo "TAG=beta" >> $GITHUB_OUTPUT
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
else
echo "TAG=latest" >> $GITHUB_OUTPUT
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
fi
if [[ "$VERSION" == 1.* ]]; then
echo "DOCS_LINE=v1" >> $GITHUB_OUTPUT
else
echo "DOCS_LINE=v2" >> $GITHUB_OUTPUT
fi
- name: Detect test tag
id: test_tag
run: |
if [[ "${{ github.ref_name }}" == *".test" ]]; then
echo "IS_TEST_TAG=true" >> $GITHUB_OUTPUT
else
echo "IS_TEST_TAG=false" >> $GITHUB_OUTPUT
fi
- name: Check npm version exists
id: npm_version
run: |
if npm view vue-element-plus-x@${{ steps.tag_type.outputs.VERSION }} version >/dev/null 2>&1; then
echo "EXISTS=true" >> $GITHUB_OUTPUT
else
echo "EXISTS=false" >> $GITHUB_OUTPUT
fi
- name: Create .tgz package
run: |
cd packages/core
npm pack
- name: Publish to npm
if: (github.event_name == 'push' || github.event.inputs.tag) && steps.npm_version.outputs.EXISTS != 'true' && steps.test_tag.outputs.IS_TEST_TAG != 'true'
run: |
cd packages/core
npm publish --tag ${{ steps.tag_type.outputs.TAG }} --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: npm-package
path: packages/core/vue-element-plus-x-${{ steps.tag_type.outputs.VERSION }}.tgz
retention-days: 90
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && steps.test_tag.outputs.IS_TEST_TAG != 'true'
with:
files: packages/core/vue-element-plus-x-${{ steps.tag_type.outputs.VERSION }}.tgz
generate_release_notes: true
draft: false
prerelease: ${{ steps.tag_type.outputs.TAG == 'beta' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docs_deploy_v1:
if: startsWith(github.ref, 'refs/tags/')
needs: release
uses: ./.github/workflows/docs-deploy-bt.yaml
with:
line: v1
source_ref: refs/heads/main
secrets: inherit
docs_deploy_v2:
if: startsWith(github.ref, 'refs/tags/')
needs: release
uses: ./.github/workflows/docs-deploy-bt.yaml
with:
line: v2
source_ref: refs/heads/updata-2602
secrets: inherit