diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04a0784a..6ac8efb7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ name: Release permissions: "contents": "write" -# This task will run whenever you push a git tag that looks like a version +# This task will run whenever you workflow_dispatch with a 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 @@ -39,9 +39,13 @@ permissions: # If there's a prerelease-style suffix to the version, then the release(s) # will be marked as a prerelease. on: - push: - tags: - - '**[0-9]+.[0-9]+.[0-9]+*' + workflow_dispatch: + inputs: + tag: + description: Release Tag + required: true + default: dry-run + type: string jobs: # Run 'dist plan' (or host) to determine what tasks we need to do @@ -49,9 +53,9 @@ jobs: runs-on: "ubuntu-20.04" outputs: val: ${{ steps.plan.outputs.manifest }} - 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 }} + 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' }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: @@ -75,7 +79,7 @@ jobs: # but also really annoying to build CI around when it needs secrets to work right.) - id: plan run: | - dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json + dist ${{ (inputs.tag && inputs.tag != 'dry-run' && format('host --steps=create --tag={0}', inputs.tag)) || 'plan' }} --output-format=json > plan-dist-manifest.json echo "dist ran successfully" cat plan-dist-manifest.json echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT" @@ -91,7 +95,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') }} + 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' }} strategy: fail-fast: false # Target platforms/runners are computed by dist in create-release. diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml deleted file mode 100644 index 03b9baa9..00000000 --- a/.github/workflows/tag.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: "Git tag" - -permissions: - contents: write - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - tag: - name: Push git tag for new release - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Determine version - id: extract_version - run: | - VERSION=$(cat crates/air/Cargo.toml | grep '^version' | sed -e "s/[^.0-9]//g") - echo "air version: ${VERSION}" - echo "result=${VERSION}" >> $GITHUB_OUTPUT - - - name: Check for existing tag - id: check_tag - uses: mukunku/tag-exists-action@v1.6.0 - with: - tag: ${{ steps.extract_version.outputs.result }} - - - name: Push tag - if: ${{ steps.check_tag.outputs.exists == 'false' }} - id: tag_version - uses: mathieudutour/github-tag-action@v6.2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - custom_tag: ${{ steps.extract_version.outputs.result }} - tag_prefix: '' diff --git a/dist-workspace.toml b/dist-workspace.toml index f5ff592a..c85f54d4 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -21,6 +21,8 @@ targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux- auto-includes = false # Which actions to run on pull requests (use "upload" to force a build in CI for testing) pr-run-mode = "skip" +# Whether CI should trigger releases with dispatches instead of tag pushes +dispatch-releases = true # Path that installers should place binaries in install-path = ["$XDG_BIN_HOME/", "$XDG_DATA_HOME/../bin", "~/.local/bin"] # Whether to install an updater program