Initial commit #10
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: Dev Release | |
| on: | |
| push: | |
| branches: | |
| - "master" | |
| tags-ignore: | |
| - "**" | |
| env: | |
| BIN_NAME: ${{ github.event.repository.name }} | |
| REGISTRY: ghcr.io | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build-dev: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-latest | |
| install_deps: sudo apt-get update && sudo apt-get install -y musl-tools | |
| cpu: x86-64-v3 | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| install_deps: "false" | |
| cpu: x86-64-v3 | |
| - target: aarch64-unknown-linux-musl | |
| os: ubuntu-24.04-arm | |
| install_deps: sudo apt-get update && sudo apt-get install -y musl-tools | |
| cpu: neoverse-n1 | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-24.04-arm | |
| install_deps: "false" | |
| cpu: neoverse-n1 | |
| - target: x86_64-apple-darwin | |
| os: macos-15-intel | |
| install_deps: "false" | |
| cpu: x86-64-v3 | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| install_deps: "false" | |
| cpu: apple-m1 | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| install_deps: "false" | |
| cpu: x86-64-v3 | |
| - target: aarch64-pc-windows-msvc | |
| os: windows-11-arm | |
| install_deps: "false" | |
| cpu: cortex-a76 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install System Dependencies | |
| if: matrix.install_deps != 'false' | |
| run: ${{ matrix.install_deps }} | |
| - name: Install Rust Toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.target }} | |
| - name: Rust Cache | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| - name: Set Dev Version | |
| shell: bash | |
| run: | | |
| BASE_VERSION=$(grep -m1 'version = "' Cargo.toml | cut -d '"' -f 2) | |
| SHORT_SHA=$(git rev-parse --short HEAD) | |
| NEW_VERSION="${BASE_VERSION}-dev.${SHORT_SHA}" | |
| sed -i.bak "s/^version = .*/version = \"$NEW_VERSION\"/" Cargo.toml | |
| # RUSTFLAGS="-C target_cpu=native" and apple-m1 CPUs cause brittle behavior | |
| - name: Delete Cargo Config | |
| shell: bash | |
| run: rm -f .cargo/config.toml | |
| - name: Build Binary | |
| env: | |
| RUSTFLAGS: "-C target-cpu=${{ matrix.cpu }}" | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package Binary | |
| shell: bash | |
| run: | | |
| mkdir dist | |
| cp LICENSE dist/ | |
| if [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
| cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe" dist/ | |
| cd dist | |
| 7z a "../${{ env.BIN_NAME }}-${{ matrix.target }}.zip" "${{ env.BIN_NAME }}.exe" LICENSE | |
| else | |
| cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" dist/ | |
| cd dist | |
| tar -czf "../${{ env.BIN_NAME }}-${{ matrix.target }}.tar.gz" "${{ env.BIN_NAME }}" LICENSE | |
| fi | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: binary-${{ matrix.target }} | |
| path: ${{ env.BIN_NAME }}-${{ matrix.target }}* | |
| retention-days: 1 | |
| release-dev: | |
| name: Update Dev Release | |
| needs: build-dev | |
| continue-on-error: true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Update Pre-Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: dev | |
| name: Development Build | |
| body: "Latest development build from master. Commit: ${{ github.sha }}" | |
| prerelease: true | |
| files: artifacts/* | |
| make_latest: false | |
| docker-dev: | |
| name: Push Dev Docker | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set Dev Version | |
| shell: bash | |
| run: | | |
| BASE_VERSION=$(grep -m1 'version = "' Cargo.toml | cut -d '"' -f 2) | |
| SHORT_SHA=$(git rev-parse --short HEAD) | |
| NEW_VERSION="${BASE_VERSION}-dev.${SHORT_SHA}" | |
| sed -i.bak "s/^version = .*/version = \"$NEW_VERSION\"/" Cargo.toml | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| build-args: | | |
| LOCK_FLAG= | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ github.repository }}:dev | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |