Skip to content

Commit 46c1d26

Browse files
committed
Update cargo-dist to 0.28
1 parent b6d0cd1 commit 46c1d26

File tree

3 files changed

+58
-48
lines changed

3 files changed

+58
-48
lines changed

.github/workflows/release.yml

+35-25
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/
2+
#
13
# Copyright 2022-2024, axodotdev
24
# SPDX-License-Identifier: MIT or Apache-2.0
35
#
46
# CI that:
57
#
68
# * checks for a Git Tag that looks like a release
7-
# * builds artifacts with cargo-dist (archives, installers, hashes)
9+
# * builds artifacts with dist (archives, installers, hashes)
810
# * uploads those artifacts to temporary workflow zip
911
# * on success, uploads the artifacts to a GitHub Release
1012
#
@@ -22,10 +24,10 @@ permissions:
2224
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
2325
#
2426
# If PACKAGE_NAME is specified, then the announcement will be for that
25-
# package (erroring out if it doesn't have the given version or isn't cargo-dist-able).
27+
# package (erroring out if it doesn't have the given version or isn't dist-able).
2628
#
2729
# If PACKAGE_NAME isn't specified, then the announcement will be for all
28-
# (cargo-dist-able) packages in the workspace with that version (this mode is
30+
# (dist-able) packages in the workspace with that version (this mode is
2931
# intended for workspaces with only one dist-able package, or with all dist-able
3032
# packages versioned/released in lockstep).
3133
#
@@ -43,7 +45,7 @@ on:
4345
- '**[0-9]+.[0-9]+.[0-9]+*'
4446

4547
jobs:
46-
# Run 'cargo dist plan' (or host) to determine what tasks we need to do
48+
# Run 'dist plan' (or host) to determine what tasks we need to do
4749
plan:
4850
runs-on: "ubuntu-20.04"
4951
outputs:
@@ -57,25 +59,25 @@ jobs:
5759
- uses: actions/checkout@v4
5860
with:
5961
submodules: recursive
60-
- name: Install cargo-dist
62+
- name: Install dist
6163
# we specify bash to get pipefail; it guards against the `curl` command
6264
# failing. otherwise `sh` won't catch that `curl` returned non-0
6365
shell: bash
64-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.19.1/cargo-dist-installer.sh | sh"
65-
- name: Cache cargo-dist
66+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh | sh"
67+
- name: Cache dist
6668
uses: actions/upload-artifact@v4
6769
with:
6870
name: cargo-dist-cache
69-
path: ~/.cargo/bin/cargo-dist
71+
path: ~/.cargo/bin/dist
7072
# sure would be cool if github gave us proper conditionals...
7173
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
7274
# functionality based on whether this is a pull_request, and whether it's from a fork.
7375
# (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
7476
# but also really annoying to build CI around when it needs secrets to work right.)
7577
- id: plan
7678
run: |
77-
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
78-
echo "cargo dist ran successfully"
79+
dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
80+
echo "dist ran successfully"
7981
cat plan-dist-manifest.json
8082
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8183
- name: "Upload dist-manifest.json"
@@ -93,18 +95,19 @@ jobs:
9395
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') }}
9496
strategy:
9597
fail-fast: false
96-
# Target platforms/runners are computed by cargo-dist in create-release.
98+
# Target platforms/runners are computed by dist in create-release.
9799
# Each member of the matrix has the following arguments:
98100
#
99101
# - runner: the github runner
100-
# - dist-args: cli flags to pass to cargo dist
101-
# - install-dist: expression to run to install cargo-dist on the runner
102+
# - dist-args: cli flags to pass to dist
103+
# - install-dist: expression to run to install dist on the runner
102104
#
103105
# Typically there will be:
104106
# - 1 "global" task that builds universal installers
105107
# - N "local" tasks that build each platform's binaries and platform-specific installers
106108
matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
107109
runs-on: ${{ matrix.runner }}
110+
container: ${{ matrix.container && matrix.container.image || null }}
108111
env:
109112
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110113
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -115,8 +118,15 @@ jobs:
115118
- uses: actions/checkout@v4
116119
with:
117120
submodules: recursive
118-
- name: Install cargo-dist
119-
run: ${{ matrix.install_dist }}
121+
- name: Install Rust non-interactively if not already installed
122+
if: ${{ matrix.container }}
123+
run: |
124+
if ! command -v cargo > /dev/null 2>&1; then
125+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
126+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
127+
fi
128+
- name: Install dist
129+
run: ${{ matrix.install_dist.run }}
120130
# Get the dist-manifest
121131
- name: Fetch local artifacts
122132
uses: actions/download-artifact@v4
@@ -130,8 +140,8 @@ jobs:
130140
- name: Build artifacts
131141
run: |
132142
# Actually do builds and make zips and whatnot
133-
cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
134-
echo "cargo dist ran successfully"
143+
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
144+
echo "dist ran successfully"
135145
- id: cargo-dist
136146
name: Post-build
137147
# We force bash here just because github makes it really hard to get values up
@@ -141,7 +151,7 @@ jobs:
141151
run: |
142152
# Parse out what we just built and upload it to scratch storage
143153
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
144-
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
154+
dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
145155
echo "EOF" >> "$GITHUB_OUTPUT"
146156
147157
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -166,12 +176,12 @@ jobs:
166176
- uses: actions/checkout@v4
167177
with:
168178
submodules: recursive
169-
- name: Install cached cargo-dist
179+
- name: Install cached dist
170180
uses: actions/download-artifact@v4
171181
with:
172182
name: cargo-dist-cache
173183
path: ~/.cargo/bin/
174-
- run: chmod +x ~/.cargo/bin/cargo-dist
184+
- run: chmod +x ~/.cargo/bin/dist
175185
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
176186
- name: Fetch local artifacts
177187
uses: actions/download-artifact@v4
@@ -182,8 +192,8 @@ jobs:
182192
- id: cargo-dist
183193
shell: bash
184194
run: |
185-
cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
186-
echo "cargo dist ran successfully"
195+
dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
196+
echo "dist ran successfully"
187197
188198
# Parse out what we just built and upload it to scratch storage
189199
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -215,12 +225,12 @@ jobs:
215225
- uses: actions/checkout@v4
216226
with:
217227
submodules: recursive
218-
- name: Install cached cargo-dist
228+
- name: Install cached dist
219229
uses: actions/download-artifact@v4
220230
with:
221231
name: cargo-dist-cache
222232
path: ~/.cargo/bin/
223-
- run: chmod +x ~/.cargo/bin/cargo-dist
233+
- run: chmod +x ~/.cargo/bin/dist
224234
# Fetch artifacts from scratch-storage
225235
- name: Fetch artifacts
226236
uses: actions/download-artifact@v4
@@ -231,7 +241,7 @@ jobs:
231241
- id: host
232242
shell: bash
233243
run: |
234-
cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
244+
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
235245
echo "artifacts uploaded and released successfully"
236246
cat dist-manifest.json
237247
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"

Cargo.toml

-23
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,3 @@ strum_macros = "0.26.4"
2525
[profile.dist]
2626
inherits = "release"
2727
lto = "thin"
28-
29-
# Config for 'cargo dist'
30-
[workspace.metadata.dist]
31-
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
32-
cargo-dist-version = "0.19.1"
33-
# CI backends to support
34-
ci = "github"
35-
# The installers to generate for each app
36-
installers = ["shell", "powershell", "npm"]
37-
# Target platforms to build apps for (Rust target-triple syntax)
38-
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
39-
# The archive format to use for windows builds (defaults .zip)
40-
windows-archive = ".tar.gz"
41-
# The archive format to use for non-windows builds (defaults .tar.xz)
42-
unix-archive = ".tar.gz"
43-
# A namespace to use when publishing this package to the npm registry
44-
npm-scope = "@sirbrillig"
45-
# Path that installers should place binaries in
46-
install-path = "CARGO_HOME"
47-
# Publish jobs to run in CI
48-
pr-run-mode = "plan"
49-
# Whether to install an updater program
50-
install-updater = false

dist-workspace.toml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[workspace]
2+
members = ["cargo:."]
3+
4+
# Config for 'dist'
5+
[dist]
6+
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
7+
cargo-dist-version = "0.28.0"
8+
# CI backends to support
9+
ci = "github"
10+
# The installers to generate for each app
11+
installers = ["shell", "powershell"]
12+
# Target platforms to build apps for (Rust target-triple syntax)
13+
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
14+
# The archive format to use for windows builds (defaults .zip)
15+
windows-archive = ".tar.gz"
16+
# The archive format to use for non-windows builds (defaults .tar.xz)
17+
unix-archive = ".tar.gz"
18+
# Path that installers should place binaries in
19+
install-path = "CARGO_HOME"
20+
# Which actions to run on pull requests
21+
pr-run-mode = "plan"
22+
# Whether to install an updater program
23+
install-updater = false

0 commit comments

Comments
 (0)