| name: release_cli |
| |
| on: |
| workflow_call: |
| inputs: |
| tag_name: |
| description: 'The name of the tag to be released' |
| required: true |
| type: string |
| |
| env: |
| GITHUB_TOKEN: ${{ github.token }} |
| RUST_BACKTRACE: 1 |
| CARGO_TERM_COLOR: always |
| IGGY_CI_BUILD: true |
| |
| jobs: |
| build_cli: |
| runs-on: ${{ matrix.platform.os }} |
| strategy: |
| matrix: |
| platform: |
| - target: x86_64-unknown-linux-musl |
| os: ubuntu-latest |
| executable: iggy |
| file: iggy-cli-x86_64-unknown-linux-musl.tgz |
| - target: aarch64-unknown-linux-musl |
| os: ubuntu-latest |
| executable: iggy |
| file: iggy-cli-aarch64-unknown-linux-musl.tgz |
| - target: x86_64-unknown-linux-gnu |
| os: ubuntu-latest |
| executable: iggy |
| file: iggy-cli-x86_64-unknown-linux-gnu.tgz |
| - target: x86_64-pc-windows-msvc |
| os: windows-latest |
| executable: iggy.exe |
| file: iggy-cli-x86_64-pc-windows-msvc.zip |
| - target: aarch64-pc-windows-msvc |
| os: windows-latest |
| executable: iggy.exe |
| file: iggy-cli-aarch64-pc-windows-msvc.zip |
| - target: x86_64-apple-darwin |
| os: macos-latest |
| executable: iggy |
| file: iggy-cli-x86_64-apple-darwin.zip |
| - target: aarch64-apple-darwin |
| os: macos-latest |
| executable: iggy |
| file: iggy-cli-aarch64-apple-darwin.zip |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v4 |
| |
| - name: Cache cargo & target directories |
| uses: Swatinem/rust-cache@v2 |
| with: |
| key: "v2" |
| |
| - name: Install musl-tools on Linux |
| run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools |
| if: ${{ matrix.platform.target == 'x86_64-unknown-linux-musl' }} |
| |
| - name: Prepare ${{ matrix.platform.target }} toolchain |
| uses: actions-rs/toolchain@v1 |
| with: |
| toolchain: stable |
| override: true |
| target: ${{ matrix.platform.target }} |
| |
| - name: Install cross |
| uses: taiki-e/install-action@v2 |
| with: |
| tool: cross |
| |
| - name: Build ${{ matrix.platform.target }} release binary |
| run: cross +stable build --verbose --release --target ${{ matrix.platform.target }} |
| |
| - name: Collect ${{ matrix.platform.target }} executable |
| run: | |
| cp target/${{ matrix.platform.target }}/release/${{ matrix.platform.executable }} . |
| |
| - name: Create ${{ matrix.platform.file }} artifact |
| run: | |
| tar cvfz ${{ matrix.platform.file }} ${{ matrix.platform.executable }} |
| if: ${{ matrix.platform.os == 'ubuntu-latest' }} |
| |
| - name: Create ${{ matrix.platform.file }} artifact |
| uses: vimtor/action-zip@v1 |
| with: |
| files: ${{ matrix.platform.executable }} |
| dest: ${{ matrix.platform.file }} |
| if: ${{ matrix.platform.os == 'windows-latest' || matrix.platform.os == 'macos-latest' }} |
| |
| - name: Upload ${{ matrix.platform.file }} artifact |
| uses: actions/upload-artifact@v4 |
| with: |
| name: artifacts-${{ matrix.platform.target }} |
| path: ${{ matrix.platform.file }} |
| |
| - name: Print message |
| run: echo "::notice ::Created binary for ${{ matrix.platform.target }}" |
| |
| outputs: |
| version: ${{ needs.tag.outputs.version }} |
| |
| release_cli: |
| name: Create iggy-cli release |
| runs-on: ubuntu-latest |
| needs: build_cli |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v4 |
| with: |
| fetch-depth: 0 |
| |
| - name: Cache cargo & target directories |
| uses: Swatinem/rust-cache@v2 |
| with: |
| key: "v2" |
| |
| - name: Download all artifacts |
| uses: actions/download-artifact@v4 |
| |
| - name: List files |
| run: find |
| |
| - name: Create Changelog |
| uses: orhun/git-cliff-action@v4 |
| id: changelog |
| with: |
| config: cliff.toml |
| args: -vv --latest |
| env: |
| OUTPUT: CHANGELOG.md |
| GITHUB_REPO: ${{ github.repository }} |
| |
| - name: Create GitHub Release |
| uses: softprops/action-gh-release@v2 |
| with: |
| body: ${{ steps.changelog.outputs.content }} |
| files: | |
| artifacts-*/*.tgz |
| artifacts-*/*.zip |
| CHANGELOG.md |
| tag_name: ${{ inputs.tag_name }} |
| draft: false |
| prerelease: false |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |