Update cargo-dist setup and generated artifacts.

This commit is contained in:
KtorZ 2024-07-16 17:30:11 +02:00
parent c52ba9c873
commit e9f7e96970
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
2 changed files with 54 additions and 48 deletions

View File

@ -12,9 +12,8 @@
# title/body based on your changelogs. # title/body based on your changelogs.
name: Release name: Release
permissions: permissions:
contents: write "contents": "write"
# This task will run whenever you push a git tag that looks like a version # This task will run whenever you push a git tag that looks like a version
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc. # like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
@ -38,15 +37,15 @@ permissions:
# If there's a prerelease-style suffix to the version, then the release(s) # If there's a prerelease-style suffix to the version, then the release(s)
# will be marked as a prerelease. # will be marked as a prerelease.
on: on:
pull_request:
push: push:
tags: tags:
- '**[0-9]+.[0-9]+.[0-9]+*' - '**[0-9]+.[0-9]+.[0-9]+*'
pull_request:
jobs: jobs:
# Run 'cargo dist plan' (or host) to determine what tasks we need to do # Run 'cargo dist plan' (or host) to determine what tasks we need to do
plan: plan:
runs-on: ubuntu-latest runs-on: "ubuntu-20.04"
outputs: outputs:
val: ${{ steps.plan.outputs.manifest }} val: ${{ steps.plan.outputs.manifest }}
tag: ${{ !github.event.pull_request && github.ref_name || '' }} tag: ${{ !github.event.pull_request && github.ref_name || '' }}
@ -62,7 +61,12 @@ jobs:
# we specify bash to get pipefail; it guards against the `curl` command # we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0 # failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh" run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.19.1/cargo-dist-installer.sh | sh"
- name: Cache cargo-dist
uses: actions/upload-artifact@v4
with:
name: cargo-dist-cache
path: ~/.cargo/bin/cargo-dist
# sure would be cool if github gave us proper conditionals... # 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 # 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. # functionality based on whether this is a pull_request, and whether it's from a fork.
@ -111,9 +115,6 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- uses: swatinem/rust-cache@v2
with:
key: ${{ join(matrix.targets, '-') }}
- name: Install cargo-dist - name: Install cargo-dist
run: ${{ matrix.install_dist }} run: ${{ matrix.install_dist }}
# Get the dist-manifest # Get the dist-manifest
@ -157,7 +158,7 @@ jobs:
needs: needs:
- plan - plan
- build-local-artifacts - build-local-artifacts
runs-on: ubuntu-latest runs-on: "ubuntu-20.04"
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
@ -165,9 +166,12 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Install cargo-dist - name: Install cached cargo-dist
shell: bash uses: actions/download-artifact@v4
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh" with:
name: cargo-dist-cache
path: ~/.cargo/bin/
- run: chmod +x ~/.cargo/bin/cargo-dist
# Get all the local artifacts for the global tasks to use (for e.g. checksums) # Get all the local artifacts for the global tasks to use (for e.g. checksums)
- name: Fetch local artifacts - name: Fetch local artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@ -204,15 +208,19 @@ jobs:
if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }} if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest runs-on: "ubuntu-20.04"
outputs: outputs:
val: ${{ steps.host.outputs.manifest }} val: ${{ steps.host.outputs.manifest }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Install cargo-dist - name: Install cached cargo-dist
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh" uses: actions/download-artifact@v4
with:
name: cargo-dist-cache
path: ~/.cargo/bin/
- run: chmod +x ~/.cargo/bin/cargo-dist
# Fetch artifacts from scratch-storage # Fetch artifacts from scratch-storage
- name: Fetch artifacts - name: Fetch artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@ -220,7 +228,6 @@ jobs:
pattern: artifacts-* pattern: artifacts-*
path: target/distrib/ path: target/distrib/
merge-multiple: true merge-multiple: true
# This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
- id: host - id: host
shell: bash shell: bash
run: | run: |
@ -234,12 +241,34 @@ jobs:
# Overwrite the previous copy # Overwrite the previous copy
name: artifacts-dist-manifest name: artifacts-dist-manifest
path: dist-manifest.json path: dist-manifest.json
# Create a GitHub Release while uploading all files to it
- name: "Download GitHub Artifacts"
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
path: artifacts
merge-multiple: true
- name: Cleanup
run: |
# Remove the granular manifests
rm -f artifacts/*-dist-manifest.json
- name: Create GitHub Release
env:
PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
RELEASE_COMMIT: "${{ github.sha }}"
run: |
# Write and read notes from a file to avoid quoting breaking things
echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
publish-homebrew-formula: publish-homebrew-formula:
needs: needs:
- plan - plan
- host - host
runs-on: ubuntu-latest runs-on: "ubuntu-20.04"
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLAN: ${{ needs.plan.outputs.val }} PLAN: ${{ needs.plan.outputs.val }}
@ -279,7 +308,7 @@ jobs:
needs: needs:
- plan - plan
- host - host
runs-on: ubuntu-latest runs-on: "ubuntu-20.04"
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLAN: ${{ needs.plan.outputs.val }} PLAN: ${{ needs.plan.outputs.val }}
@ -303,7 +332,6 @@ jobs:
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Create a GitHub Release while uploading all files to it
announce: announce:
needs: needs:
- plan - plan
@ -314,28 +342,10 @@ jobs:
# still allowing individual publish jobs to skip themselves (for prereleases). # still allowing individual publish jobs to skip themselves (for prereleases).
# "host" however must run to completion, no skipping allowed! # "host" however must run to completion, no skipping allowed!
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }} if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }}
runs-on: ubuntu-latest runs-on: "ubuntu-20.04"
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: "Download GitHub Artifacts"
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
path: artifacts
merge-multiple: true
- name: Cleanup
run: |
# Remove the granular manifests
rm -f artifacts/*-dist-manifest.json
- name: Create GitHub Release
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 }}
prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
artifacts: "artifacts/*"

View File

@ -9,21 +9,15 @@ tag-name = "v{{version}}"
# Config for 'cargo dist' # Config for 'cargo dist'
[workspace.metadata.dist] [workspace.metadata.dist]
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax) # The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.14.1" cargo-dist-version = "0.19.1"
# CI backends to support # CI backends to support
ci = "github" ci = "github"
# The installers to generate for each app # The installers to generate for each app
installers = ["shell", "powershell", "npm", "homebrew"] installers = ["shell", "powershell", "npm", "homebrew", "msi"]
# A GitHub repo to push Homebrew formulas to # A GitHub repo to push Homebrew formulas to
tap = "aiken-lang/homebrew-tap" tap = "aiken-lang/homebrew-tap"
# Target platforms to build apps for (Rust target-triple syntax) # Target platforms to build apps for (Rust target-triple syntax)
targets = [ targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"x86_64-pc-windows-msvc",
]
# The archive format to use for windows builds (defaults .zip) # The archive format to use for windows builds (defaults .zip)
windows-archive = ".tar.gz" windows-archive = ".tar.gz"
# The archive format to use for non-windows builds (defaults .tar.xz) # The archive format to use for non-windows builds (defaults .tar.xz)
@ -36,7 +30,9 @@ publish-jobs = ["homebrew", "npm"]
pr-run-mode = "plan" pr-run-mode = "plan"
# Whether to install an updater program # Whether to install an updater program
install-updater = false install-updater = false
install-path = "~/.aiken/bin/" # Path that installers should place binaries in
install-path = "~/.aiken/bin"
# Whether to publish prereleases to package managers
publish-prereleases = true publish-prereleases = true
# Cargo-dist uses ubuntu-20.04 by default, causing issues in various cases # Cargo-dist uses ubuntu-20.04 by default, causing issues in various cases