fix: 修复未等待salt初始化导致的tokenId为空的情况 #99
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CreateRelease | |
| on: | |
| push: | |
| branches: [ '**' ] | |
| workflow_dispatch: | |
| inputs: | |
| platforms: | |
| description: 'Platforms to build (comma-separated: win,linux,linux-arm64,macos,macos-arm64,all)' | |
| required: false | |
| default: 'all' | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Windows x64 | |
| - os: windows-latest | |
| target: win | |
| artifact_name: antigravity-win-x64 | |
| asset_name: antigravity-win-x64.zip | |
| # Linux x64 | |
| - os: ubuntu-latest | |
| target: linux | |
| artifact_name: antigravity-linux-x64 | |
| asset_name: antigravity-linux-x64.tar.gz | |
| # Linux ARM64 (for Termux) | |
| - os: ubuntu-latest | |
| target: linux-arm64 | |
| artifact_name: antigravity-linux-arm64 | |
| asset_name: antigravity-linux-arm64.tar.gz | |
| # macOS x64 | |
| - os: macos-latest | |
| target: macos | |
| artifact_name: antigravity-macos-x64 | |
| asset_name: antigravity-macos-x64.tar.gz | |
| # macOS ARM64 | |
| - os: macos-latest | |
| target: macos-arm64 | |
| artifact_name: antigravity-macos-arm64 | |
| asset_name: antigravity-macos-arm64.tar.gz | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Prepare config file | |
| run: | | |
| if [ ! -f config.json ]; then | |
| cp config.json.example config.json | |
| fi | |
| shell: bash | |
| - name: Build binary | |
| run: npm run build:${{ matrix.target }} | |
| - name: List dist contents | |
| run: | | |
| echo "=== dist directory contents ===" | |
| ls -la dist/ | |
| shell: bash | |
| - name: Package (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| cd dist | |
| 7z a -tzip ../${{ matrix.asset_name }} * | |
| shell: pwsh | |
| - name: Package (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cd dist | |
| tar -czvf ../${{ matrix.asset_name }} * | |
| shell: bash | |
| - name: Upload artifact (compressed archive for release) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: ${{ matrix.asset_name }} | |
| retention-days: 30 | |
| compression-level: 0 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # 获取所有 tag 用于计数 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: List artifacts | |
| run: | | |
| echo "=== Downloaded artifacts ===" | |
| find artifacts -type f -ls | |
| - name: Generate release tag | |
| id: tag | |
| run: | | |
| DATE=$(date +'%Y%m%d') | |
| SHA_SHORT=$(git rev-parse --short HEAD) | |
| # 获取今天已有的 release 数量 | |
| COUNT=$(git tag -l "${DATE}.*" | wc -l) | |
| BUILD_NUM=$((COUNT + 1)) | |
| TAG="${DATE}.${BUILD_NUM}-${SHA_SHORT}" | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| echo "date=$DATE" >> $GITHUB_OUTPUT | |
| echo "build_num=$BUILD_NUM" >> $GITHUB_OUTPUT | |
| echo "sha=$SHA_SHORT" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag }} | |
| name: Build ${{ steps.tag.outputs.tag }} | |
| make_latest: ${{ github.ref_name == 'main' || github.ref_name == 'master' }} | |
| prerelease: ${{ github.ref_name != 'main' && github.ref_name != 'master' }} | |
| files: | | |
| artifacts/**/*.zip | |
| artifacts/**/*.tar.gz | |
| generate_release_notes: true | |
| body: | | |
| ## 📦 自动构建 - ${{ steps.tag.outputs.tag }} | |
| **日期**: ${{ steps.tag.outputs.date }} | |
| **今日构建**: #${{ steps.tag.outputs.build_num }} | |
| **提交**: `${{ steps.tag.outputs.sha }}` | |
| **分支**: `${{ github.ref_name }}` | |
| ### 下载说明 | |
| - **Windows x64**: `antigravity-win-x64.zip` | |
| - **Linux x64**: `antigravity-linux-x64.tar.gz` | |
| - **Linux ARM64** (Termux): `antigravity-linux-arm64.tar.gz` | |
| - **macOS x64**: `antigravity-macos-x64.tar.gz` | |
| - **macOS ARM64**: `antigravity-macos-arm64.tar.gz` | |
| draft: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |