diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8190663..1bace0f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ on: pull_request: push: tags: - - "**[0-9]+.[0-9]+.[0-9]+*" + - '**[0-9]+.[0-9]+.[0-9]+*' jobs: # Run 'cargo dist plan' (or host) to determine what tasks we need to do @@ -89,42 +89,59 @@ jobs: # Build and packages all the platform-specific things build-local-artifacts: name: build-local-artifacts (${{ join(matrix.targets, ', ') }}) + # Let the initial task tell us to not run (currently very blunt) needs: - plan if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }} strategy: fail-fast: false + # Target platforms/runners are computed by cargo-dist in create-release. + # Each member of the matrix has the following arguments: + # + # - runner: the github runner + # - dist-args: cli flags to pass to cargo dist + # - install-dist: expression to run to install cargo-dist on the runner + # + # Typically there will be: + # - 1 "global" task that builds universal installers + # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} - container: - image: alpine:latest - options: --user root env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json steps: - - name: Install dependencies + - name: enable windows longpaths run: | - apk add --no-cache git curl build-base musl-dev openssl-dev + git config --global core.longpaths true - uses: actions/checkout@v4 with: submodules: recursive - name: Install cargo-dist run: ${{ matrix.install_dist }} + # Get the dist-manifest - name: Fetch local artifacts uses: actions/download-artifact@v4 with: pattern: artifacts-* path: target/distrib/ merge-multiple: true + - name: Install dependencies + run: | + ${{ matrix.packages_install }} - name: Build artifacts run: | + # Actually do builds and make zips and whatnot cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json echo "cargo dist ran successfully" - id: cargo-dist name: Post-build - shell: sh + # We force bash here just because github makes it really hard to get values up + # to "real" actions without writing to env-vars, and writing to env-vars has + # inconsistent syntax between shell and powershell. + shell: bash run: | + # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" diff --git a/Cargo.toml b/Cargo.toml index 8bf4b90..b4c4ed3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,6 @@ dirs = "5.0.1" inherits = "release" lto = "thin" - # Config for 'cargo dist' [workspace.metadata.dist] # The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax) @@ -59,13 +58,7 @@ installers = ["shell", "homebrew"] # A GitHub repo to push Homebrew formulas to tap = "guilhermeprokisch/homebrew-smd" # Target platforms to build apps for (Rust target-triple syntax) -targets = [ - "aarch64-apple-darwin", - "x86_64-apple-darwin", - "x86_64-unknown-linux-gnu", - "x86_64-unknown-linux-musl", - "x86_64-pc-windows-msvc", -] +targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"] # Path that installers should place binaries in install-path = "CARGO_HOME" # Publish jobs to run in CI