From 3a65ebd9232669bdd14e098581904522fd98f057 Mon Sep 17 00:00:00 2001 From: Luca Visentin Date: Fri, 15 Mar 2024 14:41:18 +0100 Subject: [PATCH] ci: update cargo dist --- .github/workflows/release.yml | 61 +++++++++++++++++------------------ Cargo.toml | 6 ++-- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aab1204..c038d81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,8 +8,8 @@ # * uploads those artifacts to temporary workflow zip # * on success, uploads the artifacts to a Github Release # -# Note that the Github Release will be created with a generated -# title/body based on your changelogs. +# Note that a Github Release with this tag is assumed to exist as a draft +# with the appropriate title/body, and will be undrafted for you. name: Release @@ -62,7 +62,7 @@ jobs: # we specify bash to get pipefail; it guards against the `curl` command # failing. otherwise `sh` won't catch that `curl` returned non-0 shell: bash - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.9.0/cargo-dist-installer.sh | sh" + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.6.3/cargo-dist-installer.sh | sh" # sure would be cool if github gave us proper conditionals... # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible # functionality based on whether this is a pull_request, and whether it's from a fork. @@ -70,15 +70,15 @@ jobs: # but also really annoying to build CI around when it needs secrets to work right.) - id: plan run: | - cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json + cargo dist ${{ !github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name) || (github.event.pull_request.head.repo.fork && 'plan' || 'host --steps=check') }} --output-format=json > dist-manifest.json echo "cargo dist ran successfully" - cat plan-dist-manifest.json - echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT" + cat dist-manifest.json + echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT" - name: "Upload dist-manifest.json" - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: - name: artifacts-plan-dist-manifest - path: plan-dist-manifest.json + name: artifacts + path: dist-manifest.json # Build and packages all the platform-specific things build-local-artifacts: @@ -113,11 +113,10 @@ jobs: run: ${{ matrix.install_dist }} # Get the dist-manifest - name: Fetch local artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - pattern: artifacts-* + name: artifacts path: target/distrib/ - merge-multiple: true - name: Install dependencies run: | ${{ matrix.packages_install }} @@ -140,9 +139,9 @@ jobs: cp dist-manifest.json "$BUILD_MANIFEST_NAME" - name: "Upload artifacts" - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: - name: artifacts-build-local-${{ join(matrix.targets, '_') }} + name: artifacts path: | ${{ steps.cargo-dist.outputs.paths }} ${{ env.BUILD_MANIFEST_NAME }} @@ -161,14 +160,13 @@ jobs: with: submodules: recursive - name: Install cargo-dist - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.9.0/cargo-dist-installer.sh | sh" + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.6.3/cargo-dist-installer.sh | sh" # Get all the local artifacts for the global tasks to use (for e.g. checksums) - name: Fetch local artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - pattern: artifacts-* + name: artifacts path: target/distrib/ - merge-multiple: true - id: cargo-dist shell: bash run: | @@ -182,9 +180,9 @@ jobs: cp dist-manifest.json "$BUILD_MANIFEST_NAME" - name: "Upload artifacts" - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: - name: artifacts-build-global + name: artifacts path: | ${{ steps.cargo-dist.outputs.paths }} ${{ env.BUILD_MANIFEST_NAME }} @@ -206,14 +204,13 @@ jobs: with: submodules: recursive - name: Install cargo-dist - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.9.0/cargo-dist-installer.sh | sh" + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.6.3/cargo-dist-installer.sh | sh" # Fetch artifacts from scratch-storage - name: Fetch artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - pattern: artifacts-* + name: artifacts path: target/distrib/ - merge-multiple: true # This is a harmless no-op for Github Releases, hosting for that happens in "announce" - id: host shell: bash @@ -223,10 +220,9 @@ jobs: cat dist-manifest.json echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT" - name: "Upload dist-manifest.json" - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: - # Overwrite the previous copy - name: artifacts-dist-manifest + name: artifacts path: dist-manifest.json # Create a Github Release while uploading all files to it @@ -246,11 +242,10 @@ jobs: with: submodules: recursive - name: "Download Github Artifacts" - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - pattern: artifacts-* + name: artifacts path: artifacts - merge-multiple: true - name: Cleanup run: | # Remove the granular manifests @@ -259,7 +254,9 @@ jobs: uses: ncipollo/release-action@v1 with: tag: ${{ needs.plan.outputs.tag }} - name: ${{ fromJson(needs.host.outputs.val).announcement_title }} - body: ${{ fromJson(needs.host.outputs.val).announcement_github_body }} + allowUpdates: true + updateOnlyUnreleased: true + omitBodyDuringUpdate: true + omitNameDuringUpdate: true prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }} artifacts: "artifacts/*" diff --git a/Cargo.toml b/Cargo.toml index 6ade116..d230e3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,16 +55,16 @@ walkdir = "^2.4" # Config for 'cargo dist' [workspace.metadata.dist] # The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax) -cargo-dist-version = "0.9.0" +cargo-dist-version = "0.6.3" # CI backends to support ci = ["github"] # The installers to generate for each app installers = ["shell"] # 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"] +targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-musl"] # Publish jobs to run in CI pr-run-mode = "plan" -# Do not create a new release - just append to the one already made by release-plz +# Whether cargo-dist should create a Github Release or use an existing draft create-release = false [dev-dependencies]