Build and Upload Binaries #175
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: Build and Upload Binaries | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RELEASE_TAG: v1.1.0 | |
| jobs: | |
| create_release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| release_id: ${{ steps.create_release.outputs.id }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch all tags | |
| run: git fetch --tags --force | |
| - name: Get latest tag | |
| id: get_latest_tag | |
| run: | | |
| LATEST_TAG=$(git tag | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1) | |
| echo "Latest tag: $LATEST_TAG" | |
| echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT | |
| - name: Calculate next version | |
| id: next_version | |
| run: | | |
| LATEST_TAG=${{ steps.get_latest_tag.outputs.latest_tag }} | |
| if [ -z "$LATEST_TAG" ]; then | |
| NEXT_TAG="v1.0.0" | |
| else | |
| # Extract version numbers | |
| VERSION=${LATEST_TAG#v} | |
| MAJOR=$(echo $VERSION | cut -d. -f1) | |
| MINOR=$(echo $VERSION | cut -d. -f2) | |
| PATCH=$(echo $VERSION | cut -d. -f3) | |
| # Increment patch version | |
| PATCH=$((PATCH + 1)) | |
| NEXT_TAG="v${MAJOR}.${MINOR}.${PATCH}" | |
| fi | |
| echo "Next tag: $NEXT_TAG" | |
| echo "next_tag=$NEXT_TAG" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.next_version.outputs.next_tag }} | |
| release_name: Release ${{ steps.next_version.outputs.next_tag }} | |
| prerelease: false | |
| draft: false | |
| build: | |
| needs: create_release | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: | |
| [ | |
| ubuntu-latest, | |
| ubuntu-24.04-arm, | |
| macos-13, | |
| macos-latest, | |
| windows-latest, | |
| ] | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| binary_name: helix-cli-linux-amd64 | |
| - os: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| binary_name: helix-cli-linux-arm64 | |
| - os: macos-13 | |
| target: x86_64-apple-darwin | |
| binary_name: helix-cli-macos-amd64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| binary_name: helix-cli-macos-arm64 | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| binary_name: helix-cli-windows-amd64.exe | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install OpenSSL, pkg-config, and GCC (Linux only) | |
| if: matrix.os == 'ubuntu-20.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libssl-dev pkg-config gcc | |
| - name: Set up Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| target: ${{ matrix.target }} | |
| override: true | |
| - name: Build | |
| run: | | |
| cd helix-cli | |
| cargo build --release --target ${{ matrix.target }} | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ needs.create_release.outputs.upload_url }} | |
| asset_path: target/${{ matrix.target }}/release/${{ matrix.os == 'windows-latest' && 'helix.exe' || 'helix' }} | |
| asset_name: ${{ matrix.binary_name }} | |
| asset_content_type: application/octet-stream | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |