Skip to content

Commit

Permalink
Merge pull request #155 from axodotdev/future-dist
Browse files Browse the repository at this point in the history
Future dist
  • Loading branch information
Shnatsel authored May 24, 2024
2 parents cbb249b + 4854adf commit 38b3733
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
32 changes: 13 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a GitHub Release
#
# 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.
# Note that the GitHub Release will be created with a generated
# title/body based on your changelogs.

name: Release

permissions:
contents: write

# This task will run whenever you workflow_dispatch with a 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.
# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where
# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION
Expand All @@ -38,13 +38,9 @@ permissions:
# If there's a prerelease-style suffix to the version, then the release(s)
# will be marked as a prerelease.
on:
workflow_dispatch:
inputs:
tag:
description: Release Tag
required: true
default: dry-run
type: string
push:
tags:
- '**[0-9]+.[0-9]+.[0-9]+*'
pull_request:

jobs:
Expand All @@ -53,9 +49,9 @@ jobs:
runs-on: ubuntu-latest
outputs:
val: ${{ steps.plan.outputs.manifest }}
tag: ${{ (inputs.tag != 'dry-run' && inputs.tag) || '' }}
tag-flag: ${{ inputs.tag && inputs.tag != 'dry-run' && format('--tag={0}', inputs.tag) || '' }}
publishing: ${{ inputs.tag && inputs.tag != 'dry-run' }}
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }}
publishing: ${{ !github.event.pull_request }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
Expand All @@ -74,7 +70,7 @@ jobs:
# but also really annoying to build CI around when it needs secrets to work right.)
- id: plan
run: |
cargo dist ${{ (inputs.tag && inputs.tag != 'dry-run' && format('host --steps=create --tag={0}', inputs.tag)) || 'plan' }} --output-format=json > plan-dist-manifest.json
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
echo "cargo dist ran successfully"
cat plan-dist-manifest.json
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
Expand All @@ -90,7 +86,7 @@ jobs:
# Let the initial task tell us to not run (currently very blunt)
needs:
- plan
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') || inputs.tag == 'dry-run' }}
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
strategy:
fail-fast: false
# Target platforms/runners are computed by cargo-dist in create-release.
Expand Down Expand Up @@ -269,9 +265,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.plan.outputs.tag }}
allowUpdates: true
updateOnlyUnreleased: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
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/*"
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-
pr-run-mode = "plan"
# Whether to install an updater program
install-updater = false
# Whether cargo-dist should create a Github Release or use an existing draft
create-release = false
# Whether CI should trigger releases with dispatches instead of tag pushes
dispatch-releases = true

# The profile that 'cargo dist' will build with
[profile.dist]
Expand Down

0 comments on commit 38b3733

Please sign in to comment.