Skip to content

Release

Release #265

Workflow file for this run

name: Release
on:
workflow_dispatch:
permissions: {}
env:
RELEASE_BUILD: 'true'
DEBUG: 'napi:*'
VERSION: 0.0.0-${{ github.sha }}
jobs:
build-rust:
runs-on: ${{ matrix.settings.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
settings:
- target: aarch64-apple-darwin
os: namespace-profile-mac-default
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/clone
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: release
- name: Rustup Adds Target
run: rustup target add ${{ matrix.settings.target }}
- name: Add musl target (x86_64)
if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
run: rustup target add x86_64-unknown-linux-musl
- name: Add musl target (aarch64)
if: ${{ matrix.settings.target == 'aarch64-unknown-linux-gnu' }}
run: rustup target add aarch64-unknown-linux-musl
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
- name: Set binding version
run: |
pnpm exec tool replace-file-content packages/cli/binding/Cargo.toml 'version = "0.0.0"' 'version = "${{ env.VERSION }}"'
pnpm exec tool replace-file-content packages/global/binding/Cargo.toml 'version = "0.0.0"' 'version = "${{ env.VERSION }}"'
- name: Configure Git for access to vite-task
run: git config --global url."https://x-access-token:${{ secrets.VITE_TASK_TOKEN }}@github.com/".insteadOf "ssh://git@github.com/"
- name: Build
uses: ./.github/actions/build-upstream
with:
target: ${{ matrix.settings.target }}
skip-cache: 'true'
- name: Upload Vite+ native artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: vite-plus-native-${{ matrix.settings.target }}
path: ./packages/cli/binding/*.node
if-no-files-found: error
- name: Upload Vite+ global binding artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: vite-plus-cli-native-${{ matrix.settings.target }}
path: ./packages/global/binding/*.node
if-no-files-found: error
- name: Remove .node files before upload dist
if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
run: |
rm ./packages/core/dist/**/*.node
- name: Upload core dist
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
with:
name: core
path: ./packages/core/dist
if-no-files-found: error
- name: Upload cli dist
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
with:
name: cli
path: ./packages/cli/dist
if-no-files-found: error
- name: Upload global dist
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
with:
name: global
path: ./packages/global/dist
if-no-files-found: error
Release:
runs-on: ubuntu-latest
needs: build-rust
permissions:
contents: write
packages: write
id-token: write # Required for OIDC
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/clone
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.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: Configure Git for access to vite-task
run: git config --global url."https://x-access-token:${{ secrets.VITE_TASK_TOKEN }}@github.com/".insteadOf "ssh://git@github.com/"
- name: Download cli dist
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: packages/cli/dist
pattern: cli
merge-multiple: true
- name: Download cli binding
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: packages/cli/artifacts
pattern: vite-plus-native-*
- name: Download core dist
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: packages/core/dist
pattern: core
merge-multiple: true
- uses: ./.github/actions/download-rolldown-binaries
with:
github-token: ${{ github.token }}
target: x86_64-unknown-linux-gnu
upload: 'false'
- name: Download global dist
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: packages/global/dist
pattern: global
merge-multiple: true
- name: Download global binding to artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: packages/global/artifacts
pattern: vite-plus-cli-native-*
- name: Set npm packages version
run: |
sed -i 's/"version": "0.0.0"/"version": "${{ env.VERSION }}"/' packages/core/package.json
sed -i 's/"version": "0.0.0"/"version": "${{ env.VERSION }}"/' packages/test/package.json
sed -i 's/"version": "0.0.0"/"version": "${{ env.VERSION }}"/' packages/cli/package.json
sed -i 's/"version": "0.0.0"/"version": "${{ env.VERSION }}"/' packages/global/package.json
- name: Build test
run: pnpm --filter=@voidzero-dev/vite-plus-test build
- name: 'Setup npm'
run: |
npm install -g npm@latest
- name: Publish native addons
run: |
node ./packages/cli/publish-native-addons.ts
node ./packages/global/publish-native-addons.ts
- name: Publish
run: |
pnpm publish --filter=./packages/core --access public --no-git-checks
pnpm publish --filter=./packages/test --access public --no-git-checks
pnpm publish --filter=./packages/cli --access public --no-git-checks
pnpm publish --filter=./packages/global --access public --no-git-checks
- name: Create release body
run: |
cat > ./RELEASE_BODY.md <<EOF
## vite-plus v${{ env.VERSION }}
This is a snapshot release built from commit ${{ github.sha }}.
### Published Packages
- \`@voidzero-dev/vite-plus-core@${{ env.VERSION }}\`
- \`@voidzero-dev/vite-plus-test@${{ env.VERSION }}\`
- \`vite-plus@${{ env.VERSION }}\`
- \`vite-plus-cli@${{ env.VERSION }}\`
### Installation
\`\`\`bash
npm install -g vite-plus-cli@${{ env.VERSION }}
\`\`\`
View the full commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
EOF
- name: Create GitHub Release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
id: release
with:
body_path: ./RELEASE_BODY.md
draft: false
name: vite-plus v${{ env.VERSION }}
tag_name: v${{ env.VERSION }}
target_commitish: ${{ github.sha }}
- name: Send Discord notification
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 snapshot release is available!
**Published Packages:**
• @voidzero-dev/vite-plus-core@${{ env.VERSION }}
• @voidzero-dev/vite-plus-test@${{ env.VERSION }}
• vite-plus@${{ env.VERSION }}
• vite-plus-cli@${{ env.VERSION }}
**Install:** npm install -g vite-plus-cli@${{ env.VERSION }}
embed-url: https://github.com/${{ github.repository }}/releases/tag/v${{ env.VERSION }}