Skip to content

Commit 442ed14

Browse files
authored
update deps and cargo-dist (#29)
1 parent 85b2536 commit 442ed14

File tree

3 files changed

+179
-179
lines changed

3 files changed

+179
-179
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Copyright 2022-2023, axodotdev
1+
# Copyright 2022-2024, axodotdev
22
# SPDX-License-Identifier: MIT or Apache-2.0
33
#
44
# CI that:
55
#
66
# * checks for a Git Tag that looks like a release
77
# * builds artifacts with cargo-dist (archives, installers, hashes)
88
# * uploads those artifacts to temporary workflow zip
9-
# * on success, uploads the artifacts to a Github Release
9+
# * on success, uploads the artifacts to a GitHub Release
1010
#
11-
# Note that the Github Release will be created with a generated
11+
# Note that the GitHub Release will be created with a generated
1212
# title/body based on your changelogs.
1313

1414
name: Release
@@ -31,7 +31,7 @@ permissions:
3131
# packages versioned/released in lockstep).
3232
#
3333
# 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
34+
# spin up, creating an independent announcement for each one. However, GitHub
3535
# will hard limit this to 3 tags per commit, as it will assume more tags is a
3636
# mistake.
3737
#
@@ -62,7 +62,7 @@ jobs:
6262
# we specify bash to get pipefail; it guards against the `curl` command
6363
# failing. otherwise `sh` won't catch that `curl` returned non-0
6464
shell: bash
65-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0/cargo-dist-installer.sh | sh"
65+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
6666
# sure would be cool if github gave us proper conditionals...
6767
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
6868
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -105,10 +105,15 @@ jobs:
105105
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106106
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
107107
steps:
108+
- name: enable windows longpaths
109+
run: |
110+
git config --global core.longpaths true
108111
- uses: actions/checkout@v4
109112
with:
110113
submodules: recursive
111114
- uses: swatinem/rust-cache@v2
115+
with:
116+
key: ${{ join(matrix.targets, '-') }}
112117
- name: Install cargo-dist
113118
run: ${{ matrix.install_dist }}
114119
# Get the dist-manifest
@@ -135,7 +140,7 @@ jobs:
135140
run: |
136141
# Parse out what we just built and upload it to scratch storage
137142
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
138-
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
143+
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
139144
echo "EOF" >> "$GITHUB_OUTPUT"
140145
141146
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -161,7 +166,8 @@ jobs:
161166
with:
162167
submodules: recursive
163168
- name: Install cargo-dist
164-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0/cargo-dist-installer.sh | sh"
169+
shell: bash
170+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
165171
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
166172
- name: Fetch local artifacts
167173
uses: actions/download-artifact@v4
@@ -177,7 +183,7 @@ jobs:
177183
178184
# Parse out what we just built and upload it to scratch storage
179185
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
180-
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
186+
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
181187
echo "EOF" >> "$GITHUB_OUTPUT"
182188
183189
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -206,15 +212,15 @@ jobs:
206212
with:
207213
submodules: recursive
208214
- name: Install cargo-dist
209-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0/cargo-dist-installer.sh | sh"
215+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
210216
# Fetch artifacts from scratch-storage
211217
- name: Fetch artifacts
212218
uses: actions/download-artifact@v4
213219
with:
214220
pattern: artifacts-*
215221
path: target/distrib/
216222
merge-multiple: true
217-
# This is a harmless no-op for Github Releases, hosting for that happens in "announce"
223+
# This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
218224
- id: host
219225
shell: bash
220226
run: |
@@ -246,27 +252,30 @@ jobs:
246252
repository: "quodlibetor/homebrew-git-tools"
247253
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
248254
# So we have access to the formula
249-
- name: Fetch local artifacts
255+
- name: Fetch homebrew formulae
250256
uses: actions/download-artifact@v4
251257
with:
252258
pattern: artifacts-*
253259
path: Formula/
254260
merge-multiple: true
261+
# This is extra complex because you can make your Formula name not match your app name
262+
# so we need to find releases with a *.rb file, and publish with that filename.
255263
- name: Commit formula files
256264
run: |
257265
git config --global user.name "${GITHUB_USER}"
258266
git config --global user.email "${GITHUB_EMAIL}"
259267
260-
for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
261-
name=$(echo "$release" | jq .app_name --raw-output)
268+
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
269+
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
270+
name=$(echo "$filename" | sed "s/\.rb$//")
262271
version=$(echo "$release" | jq .app_version --raw-output)
263272
264-
git add Formula/${name}.rb
273+
git add "Formula/${filename}"
265274
git commit -m "${name} ${version}"
266275
done
267276
git push
268277
269-
# Create a Github Release while uploading all files to it
278+
# Create a GitHub Release while uploading all files to it
270279
announce:
271280
needs:
272281
- plan
@@ -283,7 +292,7 @@ jobs:
283292
- uses: actions/checkout@v4
284293
with:
285294
submodules: recursive
286-
- name: "Download Github Artifacts"
295+
- name: "Download GitHub Artifacts"
287296
uses: actions/download-artifact@v4
288297
with:
289298
pattern: artifacts-*
@@ -293,7 +302,7 @@ jobs:
293302
run: |
294303
# Remove the granular manifests
295304
rm -f artifacts/*-dist-manifest.json
296-
- name: Create Github Release
305+
- name: Create GitHub Release
297306
uses: ncipollo/release-action@v1
298307
with:
299308
tag: ${{ needs.plan.outputs.tag }}

0 commit comments

Comments
 (0)