Skip to content

Commit b5fbd26

Browse files
committed
Bump cargo-dist to 0.22.1
1 parent df90514 commit b5fbd26

File tree

2 files changed

+58
-40
lines changed

2 files changed

+58
-40
lines changed

.github/workflows/release.yml

Lines changed: 54 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
# Copyright 2022-2023, axodotdev
1+
# This file was autogenerated by cargo-dist: https://opensource.axo.dev/cargo-dist/
2+
#
3+
# 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
79
# * builds artifacts with cargo-dist (archives, installers, hashes)
810
# * uploads those artifacts to temporary workflow zip
9-
# * on success, uploads the artifacts to a Github Release
11+
# * on success, uploads the artifacts to a GitHub Release
1012
#
11-
# Note that the Github Release will be created with a generated
13+
# Note that the GitHub Release will be created with a generated
1214
# title/body based on your changelogs.
1315

1416
name: Release
15-
1617
permissions:
17-
contents: write
18+
"contents": "write"
1819

1920
# This task will run whenever you push a git tag that looks like a version
2021
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
@@ -31,22 +32,22 @@ permissions:
3132
# packages versioned/released in lockstep).
3233
#
3334
# If you push multiple tags at once, separate instances of this workflow will
34-
# spin up, creating an independent announcement for each one. However Github
35+
# spin up, creating an independent announcement for each one. However, GitHub
3536
# will hard limit this to 3 tags per commit, as it will assume more tags is a
3637
# mistake.
3738
#
3839
# If there's a prerelease-style suffix to the version, then the release(s)
3940
# will be marked as a prerelease.
4041
on:
42+
pull_request:
4143
push:
4244
tags:
4345
- '**[0-9]+.[0-9]+.[0-9]+*'
44-
pull_request:
4546

4647
jobs:
4748
# Run 'cargo dist plan' (or host) to determine what tasks we need to do
4849
plan:
49-
runs-on: ubuntu-latest
50+
runs-on: "ubuntu-20.04"
5051
outputs:
5152
val: ${{ steps.plan.outputs.manifest }}
5253
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
@@ -62,7 +63,12 @@ jobs:
6263
# we specify bash to get pipefail; it guards against the `curl` command
6364
# failing. otherwise `sh` won't catch that `curl` returned non-0
6465
shell: bash
65-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.11.0/cargo-dist-installer.sh | sh"
66+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.22.1/cargo-dist-installer.sh | sh"
67+
- name: Cache cargo-dist
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: cargo-dist-cache
71+
path: ~/.cargo/bin/cargo-dist
6672
# sure would be cool if github gave us proper conditionals...
6773
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
6874
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -105,10 +111,12 @@ jobs:
105111
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106112
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
107113
steps:
114+
- name: enable windows longpaths
115+
run: |
116+
git config --global core.longpaths true
108117
- uses: actions/checkout@v4
109118
with:
110119
submodules: recursive
111-
- uses: swatinem/rust-cache@v2
112120
- name: Install cargo-dist
113121
run: ${{ matrix.install_dist }}
114122
# Get the dist-manifest
@@ -135,7 +143,7 @@ jobs:
135143
run: |
136144
# Parse out what we just built and upload it to scratch storage
137145
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
138-
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
146+
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
139147
echo "EOF" >> "$GITHUB_OUTPUT"
140148
141149
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -160,9 +168,12 @@ jobs:
160168
- uses: actions/checkout@v4
161169
with:
162170
submodules: recursive
163-
- name: Install cargo-dist
164-
shell: bash
165-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.11.0/cargo-dist-installer.sh | sh"
171+
- name: Install cached cargo-dist
172+
uses: actions/download-artifact@v4
173+
with:
174+
name: cargo-dist-cache
175+
path: ~/.cargo/bin/
176+
- run: chmod +x ~/.cargo/bin/cargo-dist
166177
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
167178
- name: Fetch local artifacts
168179
uses: actions/download-artifact@v4
@@ -178,7 +189,7 @@ jobs:
178189
179190
# Parse out what we just built and upload it to scratch storage
180191
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
181-
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
192+
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
182193
echo "EOF" >> "$GITHUB_OUTPUT"
183194
184195
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -206,16 +217,19 @@ jobs:
206217
- uses: actions/checkout@v4
207218
with:
208219
submodules: recursive
209-
- name: Install cargo-dist
210-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.11.0/cargo-dist-installer.sh | sh"
220+
- name: Install cached cargo-dist
221+
uses: actions/download-artifact@v4
222+
with:
223+
name: cargo-dist-cache
224+
path: ~/.cargo/bin/
225+
- run: chmod +x ~/.cargo/bin/cargo-dist
211226
# Fetch artifacts from scratch-storage
212227
- name: Fetch artifacts
213228
uses: actions/download-artifact@v4
214229
with:
215230
pattern: artifacts-*
216231
path: target/distrib/
217232
merge-multiple: true
218-
# This is a harmless no-op for Github Releases, hosting for that happens in "announce"
219233
- id: host
220234
shell: bash
221235
run: |
@@ -229,8 +243,29 @@ jobs:
229243
# Overwrite the previous copy
230244
name: artifacts-dist-manifest
231245
path: dist-manifest.json
246+
# Create a GitHub Release while uploading all files to it
247+
- name: "Download GitHub Artifacts"
248+
uses: actions/download-artifact@v4
249+
with:
250+
pattern: artifacts-*
251+
path: artifacts
252+
merge-multiple: true
253+
- name: Cleanup
254+
run: |
255+
# Remove the granular manifests
256+
rm -f artifacts/*-dist-manifest.json
257+
- name: Create GitHub Release
258+
env:
259+
PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
260+
ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
261+
ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
262+
RELEASE_COMMIT: "${{ github.sha }}"
263+
run: |
264+
# Write and read notes from a file to avoid quoting breaking things
265+
echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
266+
267+
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
232268
233-
# Create a Github Release while uploading all files to it
234269
announce:
235270
needs:
236271
- plan
@@ -246,21 +281,3 @@ jobs:
246281
- uses: actions/checkout@v4
247282
with:
248283
submodules: recursive
249-
- name: "Download Github Artifacts"
250-
uses: actions/download-artifact@v4
251-
with:
252-
pattern: artifacts-*
253-
path: artifacts
254-
merge-multiple: true
255-
- name: Cleanup
256-
run: |
257-
# Remove the granular manifests
258-
rm -f artifacts/*-dist-manifest.json
259-
- name: Create Github Release
260-
uses: ncipollo/release-action@v1
261-
with:
262-
tag: ${{ needs.plan.outputs.tag }}
263-
name: ${{ fromJson(needs.host.outputs.val).announcement_title }}
264-
body: ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
265-
prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
266-
artifacts: "artifacts/*"

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@ lto = "thin"
2323
# Config for 'cargo dist'
2424
[workspace.metadata.dist]
2525
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
26-
cargo-dist-version = "0.11.0"
26+
cargo-dist-version = "0.22.1"
2727
# CI backends to support
28-
ci = ["github"]
28+
ci = "github"
2929
# The installers to generate for each app
3030
installers = ["npm"]
3131
# Target platforms to build apps for (Rust target-triple syntax)
3232
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
33-
# Publish jobs to run in CI
33+
# Which actions to run on pull requests
3434
pr-run-mode = "plan"
3535
# The archive format to use for windows builds (defaults .zip)
3636
windows-archive = ".tar.gz"
3737
# The archive format to use for non-windows builds (defaults .tar.xz)
3838
unix-archive = ".tar.gz"
39+
# A namespace to use when publishing this package to the npm registry
3940
npm-scope = "@your-tools"

0 commit comments

Comments
 (0)