Manual Build and Release (v2.1) #37
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: Manual Build and Release (v2.1) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_version: | |
| description: 'Optional: Specify a release version (e.g., v1.2.3.4). If blank, an automatic version will be generated.' | |
| required: false | |
| default: '' | |
| jobs: | |
| build-ubuntu: | |
| name: Build on Ubuntu ${{ matrix.os_version }} | |
| runs-on: ${{ matrix.os_version }} | |
| strategy: | |
| matrix: | |
| os_version: [ubuntu-22.04, ubuntu-24.04] | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libcurl4-openssl-dev libreadline-dev zlib1g-dev | |
| - name: Build Application | |
| run: make | |
| - name: Rename binary for release | |
| run: mv gemini-cli gemini-cli-${{ matrix.os_version }}-x86_64 | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gemini-cli-${{ matrix.os_version }} | |
| path: gemini-cli-${{ matrix.os_version }}-x86_64 | |
| build-opensuse: | |
| name: Build on openSUSE Tumbleweed | |
| runs-on: ubuntu-latest | |
| container: | |
| image: opensuse/tumbleweed | |
| steps: | |
| - name: Install Dependencies | |
| run: | | |
| zypper --non-interactive refresh | |
| zypper --non-interactive dup --no-recommends | |
| zypper --non-interactive install --no-recommends gcc make libcurl-devel readline-devel zlib-devel | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Build Application | |
| run: make | |
| - name: Rename binary for release | |
| run: mv gemini-cli gemini-cli-opensuse-x86_64 | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gemini-cli-opensuse | |
| path: gemini-cli-opensuse-x86_64 | |
| release: | |
| name: Create and Publish Release | |
| needs: [build-ubuntu, build-opensuse] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Required to create a release | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./release-assets | |
| # This is the new logic to determine the version | |
| - name: Determine Version | |
| id: get_version | |
| run: | | |
| # If the user provided a version input, use it. | |
| if [ -n "${{ github.event.inputs.release_version }}" ]; then | |
| echo "VERSION=${{ github.event.inputs.release_version }}" >> $GITHUB_ENV | |
| # Otherwise, generate an automatic version: v1.YYYYMMDD.build_number | |
| else | |
| echo "VERSION=v1.$(date +'%Y%m%d').${{ github.run_number }}" >> $GITHUB_ENV | |
| fi | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| # Use the version determined in the previous step | |
| tag_name: ${{ env.VERSION }} | |
| release_name: "Release ${{ env.VERSION }}" | |
| body: | | |
| Automatic release of version ${{ env.VERSION }}. | |
| **Binaries:** | |
| - `gemini-cli-ubuntu-22.04-x86_64` | |
| - `gemini-cli-ubuntu-24.04-x86_64` | |
| - `gemini-cli-opensuse-x86_64` | |
| # Set draft to false to publish the release automatically | |
| draft: false | |
| prerelease: false | |
| - name: Upload Ubuntu 22.04 Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./release-assets/gemini-cli-ubuntu-22.04/gemini-cli-ubuntu-22.04-x86_64 | |
| asset_name: gemini-cli-ubuntu-22.04-x86_64 | |
| asset_content_type: application/octet-stream | |
| - name: Upload Ubuntu 24.04 Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./release-assets/gemini-cli-ubuntu-24.04/gemini-cli-ubuntu-24.04-x86_64 | |
| asset_name: gemini-cli-ubuntu-24.04-x86_64 | |
| asset_content_type: application/octet-stream | |
| - name: Upload openSUSE Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./release-assets/gemini-cli-opensuse/gemini-cli-opensuse-x86_64 | |
| asset_name: gemini-cli-opensuse-x86_64 | |
| asset_content_type: application/octet-stream |