Release #6
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., v0.1.0)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| name: aingle-minimal-linux-x86_64 | |
| cortex_name: aingle-cortex-linux-x86_64 | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| name: aingle-minimal-linux-aarch64 | |
| cortex_name: aingle-cortex-linux-aarch64 | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| name: aingle-minimal-macos-x86_64 | |
| cortex_name: aingle-cortex-macos-x86_64 | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| name: aingle-minimal-macos-aarch64 | |
| cortex_name: aingle-cortex-macos-aarch64 | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| name: aingle-minimal-windows-x86_64.exe | |
| cortex_name: aingle-cortex-windows-x86_64.exe | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install system dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libsodium-dev libssl-dev pkg-config | |
| if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| fi | |
| - name: Install system dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install libsodium openssl@3 | |
| - name: Cache cargo registry | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-cargo-release- | |
| - name: Build aingle-minimal | |
| run: cargo build --release --target ${{ matrix.target }} -p aingle_minimal --features rest | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
| - name: Build aingle-cortex | |
| run: cargo build --release --target ${{ matrix.target }} -p aingle_cortex | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
| - name: Create archives (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| mkdir -p dist | |
| cp target/${{ matrix.target }}/release/aingle-minimal dist/${{ matrix.name }} | |
| cp target/${{ matrix.target }}/release/aingle-cortex dist/${{ matrix.cortex_name }} | |
| cd dist | |
| tar -czvf ${{ matrix.name }}.tar.gz ${{ matrix.name }} | |
| tar -czvf ${{ matrix.cortex_name }}.tar.gz ${{ matrix.cortex_name }} | |
| - name: Create archives (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| mkdir dist | |
| copy target\${{ matrix.target }}\release\aingle-minimal.exe dist\${{ matrix.name }} | |
| copy target\${{ matrix.target }}\release\aingle-cortex.exe dist\${{ matrix.cortex_name }} | |
| cd dist | |
| 7z a -tzip ${{ matrix.name }}.zip ${{ matrix.name }} | |
| 7z a -tzip ${{ matrix.cortex_name }}.zip ${{ matrix.cortex_name }} | |
| - name: Upload aingle-minimal artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ matrix.name }} | |
| path: dist/${{ matrix.name }}.* | |
| - name: Upload aingle-cortex artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ matrix.cortex_name }} | |
| path: dist/${{ matrix.cortex_name }}.* | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -laR artifacts/ | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| echo "## Changes" > CHANGELOG.md | |
| git log --pretty=format:"- %s (%h)" $(git describe --tags --abbrev=0 HEAD^)..HEAD >> CHANGELOG.md 2>/dev/null || echo "- Initial release" >> CHANGELOG.md | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: artifacts/**/* | |
| body_path: CHANGELOG.md | |
| draft: false | |
| prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }} | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Publish to crates.io (optional, requires CARGO_REGISTRY_TOKEN secret) | |
| publish: | |
| name: Publish to crates.io | |
| needs: release | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libsodium-dev libssl-dev pkg-config | |
| - name: Publish aingle_zome_types | |
| run: cargo publish -p aingle_zome_types --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| continue-on-error: true | |
| - name: Publish aingle_cortex | |
| run: cargo publish -p aingle_cortex --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| continue-on-error: true | |
| - name: Publish aingle_minimal | |
| run: cargo publish -p aingle_minimal --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| continue-on-error: true |