name: Release on: push: tags: - "v*" jobs: build: name: Build for ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: include: - os: ubuntu-latest target: x86_64-unknown-linux-gnu asset_name: codebase-to-prompt-linux-amd64 - os: windows-latest target: x86_64-pc-windows-msvc asset_name: codebase-to-prompt-windows-amd64.exe steps: - name: Checkout code uses: actions/checkout@v4 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Build binary run: cargo build --release --target ${{ matrix.target }} - name: Prepare artifact path id: artifact_path shell: bash run: | if [ "${{ matrix.os }}" = "windows-latest" ]; then echo "path=target/${{ matrix.target }}/release/codebase-to-prompt.exe" >> $GITHUB_OUTPUT else echo "path=target/${{ matrix.target }}/release/codebase-to-prompt" >> $GITHUB_OUTPUT fi - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.asset_name }} path: ${{ steps.artifact_path.outputs.path }} release: name: Create GitHub Release needs: build runs-on: ubuntu-latest permissions: contents: write # This is required to create a release and upload assets steps: - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts/ - name: Create Release and Upload Assets uses: softprops/action-gh-release@v2 with: files: | artifacts/codebase-to-prompt-linux-amd64/* artifacts/codebase-to-prompt-windows-amd64.exe/*