Skip to content

Release

Release #416

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
npm_tag:
description: 'npm tag for publish'
required: true
default: 'latest'
type: choice
options:
- latest
- alpha
version:
description: 'Override version (leave empty to auto-compute). Use when retrying a failed publish.'
required: false
default: ''
type: string
permissions: {}
env:
RELEASE_BUILD: 'true'
DEBUG: 'napi:*'
NPM_TAG: ${{ inputs.npm_tag }}
jobs:
prepare:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- uses: ./.github/actions/set-snapshot-version
if: ${{ inputs.version == '' }}
id: computed
with:
npm_tag: ${{ inputs.npm_tag }}
- name: Set final version
id: version
env:
INPUT_VERSION: ${{ inputs.version }}
COMPUTED_VERSION: ${{ steps.computed.outputs.version }}
run: echo "version=${INPUT_VERSION:-$COMPUTED_VERSION}" >> "$GITHUB_OUTPUT"
build-rust:
name: Build bindings and binaries
needs: prepare
permissions:
contents: read
uses: ./.github/workflows/reusable-release-build.yml
with:
version: ${{ needs.prepare.outputs.version }}
cache-key: release
Release:
runs-on: ubuntu-latest
needs: [prepare, build-rust]
permissions:
contents: write
packages: write
id-token: write # Required for OIDC
env:
VERSION: ${{ needs.prepare.outputs.version }}
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- uses: ./.github/actions/clone
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: .node-version
package-manager-cache: false
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Download cli dist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: packages/cli/dist
pattern: cli
merge-multiple: true
- name: Download cli docs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: packages/cli/docs
pattern: cli-docs
merge-multiple: true
- name: Download cli binding
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: packages/cli/artifacts
pattern: vite-plus-native-*
- name: Download core dist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: packages/core/dist
pattern: core
merge-multiple: true
- name: Download LICENSE files
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: packages
pattern: licenses
merge-multiple: true
- uses: ./.github/actions/download-rolldown-binaries
with:
github-token: ${{ github.token }}
target: x86_64-unknown-linux-gnu
upload: 'false'
- name: Download Rust CLI binaries
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: rust-cli-artifacts
pattern: vite-global-cli-*
- name: Download installer binaries (Windows)
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: installer-artifacts
pattern: vp-setup-*
- name: Prepare installer binaries for release
run: |
mkdir -p installer-release
for artifact_dir in installer-artifacts/vp-setup-*/; do
if [ -d "$artifact_dir" ]; then
dir_name=$(basename "$artifact_dir")
target_name=${dir_name#vp-setup-}
cp "$artifact_dir/vp-setup.exe" "installer-release/vp-setup-${target_name}.exe"
fi
done
echo "Installer binaries:"
ls -la installer-release/ || echo "No installer binaries found"
- name: 'Setup npm'
run: npm install -g npm@latest
- name: Prepare and publish native addons
run: node ./packages/cli/publish-native-addons.ts --mode npm
- name: Publish
run: |
pnpm publish --filter=./packages/core --tag "${NPM_TAG}" --access public --no-git-checks
pnpm publish --filter=./packages/test --tag "${NPM_TAG}" --access public --no-git-checks
pnpm publish --filter=./packages/cli --tag "${NPM_TAG}" --access public --no-git-checks
- name: Create release body
env:
REPOSITORY: ${{ github.repository }}
COMMIT_SHA: ${{ github.sha }}
run: |
if [[ "${NPM_TAG}" == "latest" ]]; then
INSTALL_BASH="curl -fsSL https://vite.plus | bash"
INSTALL_PS1="irm https://vite.plus/ps1 | iex"
else
INSTALL_BASH="curl -fsSL https://vite.plus | VP_VERSION=${VERSION} bash"
INSTALL_PS1="\\\$env:VP_VERSION=\\\"${VERSION}\\\"; irm https://vite.plus/ps1 | iex"
fi
cat > ./RELEASE_BODY.md <<EOF
## vite-plus v${VERSION}
### Published Packages
- \`@voidzero-dev/vite-plus-core@${VERSION}\`
- \`@voidzero-dev/vite-plus-test@${VERSION}\`
- \`vite-plus@${VERSION}\`
### Installation
**macOS/Linux:**
\`\`\`bash
${INSTALL_BASH}
\`\`\`
**Windows:**
\`\`\`powershell
${INSTALL_PS1}
\`\`\`
Or download and run \`vp-setup.exe\` from the assets below.
View the full commit: https://github.com/${REPOSITORY}/commit/${COMMIT_SHA}
EOF
- name: Create GitHub Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
id: release
with:
body_path: ./RELEASE_BODY.md
draft: false
make_latest: ${{ inputs.npm_tag == 'latest' }}
prerelease: ${{ inputs.npm_tag == 'alpha' }}
name: vite-plus v${{ env.VERSION }}
tag_name: v${{ env.VERSION }}
target_commitish: ${{ github.sha }}
files: |
installer-release/vp-setup-*.exe
- name: Send Discord notification
if: ${{ inputs.npm_tag == 'latest' }}
uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645 # v7.0.0
with:
webhook-url: ${{ secrets.DISCORD_RELEASES_WEBHOOK_URL }}
embed-title: vite-plus v${{ env.VERSION }}
embed-description: |
A new release is available!
**Published Packages:**
• @voidzero-dev/vite-plus-core@${{ env.VERSION }}
• @voidzero-dev/vite-plus-test@${{ env.VERSION }}
• vite-plus@${{ env.VERSION }}
**Install:**
• macOS/Linux: `curl -fsSL https://vite.plus | bash`
• Windows: `irm https://vite.plus/ps1 | iex`
embed-url: https://github.com/${{ github.repository }}/releases/tag/v${{ env.VERSION }}