Cross-Platform Release #7
Workflow file for this run
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: Cross-Platform Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag for the release (e.g., v1.0.0)' | |
| required: true | |
| type: string | |
| jobs: | |
| build-release: | |
| name: Build & Upload Binaries | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| ext: "" | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| ext: "" | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| ext: "" | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| ext: "" | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| ext: ".exe" | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| ext: ".exe" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| profile: minimal | |
| target: ${{ matrix.target }} | |
| - name: Build release binary (ARM Linux native) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| cargo install cross --git https://github.com/cross-rs/cross | |
| cross build --release --target ${{ matrix.target }} | |
| - name: Build release binary (cross-compile) | |
| if: matrix.target != 'aarch64-unknown-linux-gnu' | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Rename binary | |
| run: | | |
| mv target/${{ matrix.target }}/release/vipyrdocs${{ matrix.ext }} vipyrdocs-${{ matrix.target }}${{ matrix.ext }} | |
| - name: Upload binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vipyrdocs-${{ matrix.target }}${{ matrix.ext }} | |
| path: vipyrdocs-${{ matrix.target }}${{ matrix.ext }} | |
| package-source: | |
| name: Package & Upload Source | |
| runs-on: ubuntu-latest | |
| needs: build-release | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Package source code | |
| run: tar czvf vipyrdocs-source.tar.gz . | |
| - name: Upload source tarball | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vipyrdocs-source.tar.gz | |
| path: vipyrdocs-source.tar.gz | |
| create-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [build-release, package-source] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Validate tag format | |
| run: | | |
| if [[ ! "${{ inputs.tag }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.-]+)?$ ]]; then | |
| echo "Error: Tag must follow semantic versioning format (e.g., v1.0.0, v1.0.0-alpha, v1.0.0+build.1)" | |
| exit 1 | |
| fi | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ inputs.tag }} | |
| name: Release ${{ inputs.tag }} | |
| draft: false | |
| prerelease: ${{ contains(inputs.tag, '-') }} | |
| files: artifacts/**/* |