Repository: axodotdev/cargo-dist
Pull request #336 (2023-08-17 14:10:20)

fix: properly pass --dir to gh release download


Patch:
diff --git a/cargo-dist/templates/ci/github_ci.yml.j2 b/cargo-dist/templates/ci/github_ci.yml.j2
index 6e944c25..9b4c8f21 100644
--- a/cargo-dist/templates/ci/github_ci.yml.j2
+++ b/cargo-dist/templates/ci/github_ci.yml.j2
@@ -98,7 +98,6 @@ jobs:
           dist-args: {{{ task.dist_args }}}
           install-dist: {{{ task.install_dist }}}
         {{%- endfor %}}
-
     runs-on: ${{ matrix.os }}
     env:
       GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -130,7 +129,8 @@ jobs:
           gh release upload ${{ github.ref_name }} $(cat uploads.txt)
           echo "uploaded!"
 
-  {{%- if global_task %}} 
+  {{%- if global_task %}}
+
   # Build and packages all the platform-agnostic(ish) things
   upload-global-artifacts:
     needs: upload-local-artifacts
@@ -147,10 +147,10 @@ jobs:
       {{%- endif %}}
       - name: Install cargo-dist
         run: {{{ global_task.install_dist }}}
-      # Get all the local artifacts for the global tasks to use
+      # Get all the local artifacts for the global tasks to use (for e.g. checksums)
       - name: Fetch local artifacts
         run: |
-          gh release download ${{ github.ref_name }} target/distrib/
+          gh release download ${{ github.ref_name }} --dir target/distrib/
       - name: Run cargo-dist
         # This logic is a bit janky because it's trying to be a polyglot between
         # powershell and bash since this will run on windows, macos, and linux!
@@ -167,7 +167,7 @@ jobs:
           cat uploads.txt
           gh release upload ${{ github.ref_name }} $(cat uploads.txt)
           echo "uploaded!"
-  {{%- endif %}} 
+  {{%- endif %}}
 
   # Mark the Github Release™ as a non-draft now that everything has succeeded!
   publish-release:


Test patch:
diff --git a/cargo-dist/tests/snapshots/akaikatana_basic.snap b/cargo-dist/tests/snapshots/akaikatana_basic.snap
index c3057ba5..9e1490c3 100644
--- a/cargo-dist/tests/snapshots/akaikatana_basic.snap
+++ b/cargo-dist/tests/snapshots/akaikatana_basic.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -1344,7 +1343,6 @@ jobs:
         - os: "ubuntu-20.04"
           dist-args: "--artifacts=local --target=x86_64-unknown-linux-gnu"
           install-dist: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh"
-
     runs-on: ${{ matrix.os }}
     env:
       GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1372,7 +1370,8 @@ jobs:
           echo "uploading..."
           cat uploads.txt
           gh release upload ${{ github.ref_name }} $(cat uploads.txt)
-          echo "uploaded!" 
+          echo "uploaded!"
+
   # Build and packages all the platform-agnostic(ish) things
   upload-global-artifacts:
     needs: upload-local-artifacts
@@ -1387,10 +1386,10 @@ jobs:
         run: rustup update "1.67.1" --no-self-update && rustup default "1.67.1"
       - name: Install cargo-dist
         run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh"
-      # Get all the local artifacts for the global tasks to use
+      # Get all the local artifacts for the global tasks to use (for e.g. checksums)
       - name: Fetch local artifacts
         run: |
-          gh release download ${{ github.ref_name }} target/distrib/
+          gh release download ${{ github.ref_name }} --dir target/distrib/
       - name: Run cargo-dist
         # This logic is a bit janky because it's trying to be a polyglot between
         # powershell and bash since this will run on windows, macos, and linux!
@@ -1406,7 +1405,7 @@ jobs:
           echo "uploading..."
           cat uploads.txt
           gh release upload ${{ github.ref_name }} $(cat uploads.txt)
-          echo "uploaded!" 
+          echo "uploaded!"
 
   # Mark the Github Release™ as a non-draft now that everything has succeeded!
   publish-release:
diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic.snap b/cargo-dist/tests/snapshots/axolotlsay_basic.snap
index 89115b1f..33aaca90 100644
--- a/cargo-dist/tests/snapshots/axolotlsay_basic.snap
+++ b/cargo-dist/tests/snapshots/axolotlsay_basic.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -2215,7 +2214,6 @@ jobs:
         - os: "ubuntu-20.04"
           dist-args: "--artifacts=local --target=x86_64-unknown-linux-gnu"
           install-dist: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh"
-
     runs-on: ${{ matrix.os }}
     env:
       GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -2241,7 +2239,8 @@ jobs:
           echo "uploading..."
           cat uploads.txt
           gh release upload ${{ github.ref_name }} $(cat uploads.txt)
-          echo "uploaded!" 
+          echo "uploaded!"
+
   # Build and packages all the platform-agnostic(ish) things
   upload-global-artifacts:
     needs: upload-local-artifacts
@@ -2254,10 +2253,10 @@ jobs:
           submodules: recursive
       - name: Install cargo-dist
         run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/vSOME_VERSION/cargo-dist-installer.sh | sh"
-      # Get all the local artifacts for the global tasks to use
+      # Get all the local artifacts for the global tasks to use (for e.g. checksums)
       - name: Fetch local artifacts
         run: |
-          gh release download ${{ github.ref_name }} target/distrib/
+          gh release download ${{ github.ref_name }} --dir target/distrib/
       - name: Run cargo-dist
         # This logic is a bit janky because it's trying to be a polyglot between
         # powershell and bash since this will run on windows, macos, and linux!
@@ -2273,7 +2272,7 @@ jobs:
           echo "uploading..."
           cat uploads.txt
           gh release upload ${{ github.ref_name }} $(cat uploads.txt)
-          echo "uploaded!" 
+          echo "uploaded!"
 
   # Mark the Github Release™ as a non-draft now that everything has succeeded!
   publish-release: