Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# Cargo.toml files drop `publish = false`, envschema-derive and envschema).
# A release happens by itself once CI passes on main with a workspace version (Cargo.toml) that has no release yet, so
# a version bump is all it takes and the docs never describe a CLI nobody can download. The cli-version job in ci.yml
# fails when the CLI changed since its last release without a bump. Pushing a v* tag by hand still works too.
# fails when the CLI changed since its last release without a bump. Pushing a vX.Y.Z tag by hand still works too.
# Each release also moves the floating major tag (v0) to it: the docs pin the GitHub Action as @v0, so users get the
# newest action, and through its default `version`, the newest CLI, without editing their workflows.
name: Release CLI

on:
Expand All @@ -12,7 +14,7 @@ on:
types: [completed]
branches: [main]
push:
tags: ["v*"]
tags: ["v*.*.*"]

permissions:
contents: write
Expand Down Expand Up @@ -97,6 +99,21 @@ jobs:
run: |
gh release create "${{ needs.version.outputs.tag }}" visualci-*.tar.gz* -R "${{ github.repository }}" \
--target "${{ needs.version.outputs.sha }}" --generate-notes
# The floating major tag (v0) follows the newest release. Created with the workflow's token, so it starts no
# workflow of its own (and the tag trigger above only matches vX.Y.Z).
- env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ needs.version.outputs.tag }}
SHA: ${{ needs.version.outputs.sha }}
REPO: ${{ github.repository }}
run: |
major="${TAG%%.*}"
if gh api "repos/$REPO/git/ref/tags/$major" >/dev/null 2>&1; then
gh api -X PATCH "repos/$REPO/git/refs/tags/$major" -f sha="$SHA" -F force=true >/dev/null
else
gh api -X POST "repos/$REPO/git/refs" -f ref="refs/tags/$major" -f sha="$SHA" >/dev/null
fi
echo "$major now points at $TAG ($SHA)"

# snapshot-diff on crates.io (https://crates.io/crates/snapshot-diff), once per version in its Cargo.toml, with
# crates.io's trusted publishing: the job trades GitHub's OIDC token for a short-lived crates.io token (configured on
Expand Down
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ design is in `docs/design.md`; read it before changing the architecture, and upd
`node scripts/skills.mjs` in `frontend` and commit `skills/`; CI fails when they differ. Bump the version in
`.claude-plugin/plugin.json` and `marketplace.json` when a skill changes.
- A change to the CLI (crates/visualci-cli or crates/visualci-core) bumps the workspace version in Cargo.toml and
Cargo.lock's visualci-* entries. CI's `cli-version` job fails without the bump; once CI passes on main, the release
Cargo.lock's visualci-* entries, and the version defaults in clients/github-action/action.yml and
clients/circleci-orb/orb.yml. CI's `cli-version` job fails without them; once CI passes on main, the release
workflow publishes it. The docs never name a CLI version: they write `{{cli_version}}`
(`VISUALCI_VERSION={{cli_version}}`, `github-action@v{{cli_version}}`), which the site build fills in with the newest
published release (`frontend/scripts/cli-version.mjs`), so they never pin an old CLI or one nobody can download yet.
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "3"
members = ["crates/*", "app"]

[workspace.package]
version = "0.2.25"
version = "0.2.26"
edition = "2024"
license = "Apache-2.0"
repository = "https://github.com/DocSpring/visualci"
Expand Down
1 change: 1 addition & 0 deletions app/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ pub const OTHER_PROGRAMS: &[&str] = &[
"VISUALCI_BRANCH",
"VISUALCI_COMMIT",
"VISUALCI_PR",
"VISUALCI_BASE_BRANCH",
"VISUALCI_ENVIRONMENT",
"VISUALCI_GROUPS",
"VISUALCI_CONFIG",
Expand Down
10 changes: 5 additions & 5 deletions clients/circleci-orb/orb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ commands:
parameters:
version:
type: string
default: "0.2.8"
description: The CLI release to install, such as 0.2.8. Pin it, so a new release never changes a build.
default: "0.2.26"
description: The CLI release to install, such as 0.2.26. Pin it, so a new release never changes a build.
install-dir:
type: string
default: $HOME/.local/bin
Expand Down Expand Up @@ -70,7 +70,7 @@ commands:
description: Fail the step when VisualCI can't be reached. By default it only reports.
version:
type: string
default: "0.2.8"
default: "0.2.26"
steps:
- install:
version: << parameters.version >>
Expand Down Expand Up @@ -117,7 +117,7 @@ commands:
default: false
version:
type: string
default: "0.2.8"
default: "0.2.26"
steps:
- install:
version: << parameters.version >>
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
default: false
version:
type: string
default: "0.2.8"
default: "0.2.26"
steps:
- install:
version: << parameters.version >>
Expand Down
16 changes: 12 additions & 4 deletions clients/github-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ inputs:
required: false
default: "false"
version:
description: The visualci CLI release to install. Pin it, so a new release never changes a build.
description: >
The visualci CLI release to install. Default: the release this tag of the action came with, so @v0 installs the
newest. Pin it to keep a release from changing a build.
required: false
default: "0.2.8"
default: "0.2.26"
cli:
description: A visualci binary to use instead of installing a release (VisualCI's own CI tests its latest CLI).
required: false
Expand Down Expand Up @@ -118,14 +120,19 @@ runs:
HEAD_REPO: ${{ github.event.workflow_run.head_repository.full_name }}
HEAD_OWNER: ${{ github.event.workflow_run.head_repository.owner.login }}
SAME_REPO_PR: ${{ github.event.workflow_run.pull_requests[0].number }}
SAME_REPO_BASE: ${{ github.event.workflow_run.pull_requests[0].base.ref }}
EVENT: ${{ github.event.workflow_run.event }}
run: |
branch="$HEAD_BRANCH"
pr="$SAME_REPO_PR"
base="$SAME_REPO_BASE"
if [ "$HEAD_REPO" != "$GITHUB_REPOSITORY" ]; then
branch="$HEAD_OWNER:$HEAD_BRANCH"
pr=$(gh api -X GET "repos/$GITHUB_REPOSITORY/pulls" -f state=open -f "head=$HEAD_OWNER:$HEAD_BRANCH" \
--jq "map(select(.head.sha == \"$HEAD_SHA\")) | .[0].number // empty")
found=$(gh api -X GET "repos/$GITHUB_REPOSITORY/pulls" -f state=open -f "head=$HEAD_OWNER:$HEAD_BRANCH" \
--jq "map(select(.head.sha == \"$HEAD_SHA\")) | .[0] // empty | \"\\(.number) \\(.base.ref)\"")
pr="${found%% *}"
base="${found#* }"
[ -n "$found" ] || base=""
fi
if [ "$EVENT" = pull_request ] && [ -z "$pr" ]; then
echo "::warning title=VisualCI::No open pull request has commit $HEAD_SHA any more (it was pushed to or closed); sending the build without one."
Expand All @@ -134,6 +141,7 @@ runs:
echo "VISUALCI_COMMIT=$HEAD_SHA"
echo "VISUALCI_BRANCH=$branch"
echo "VISUALCI_PR=${pr:-false}"
[ -z "$pr" ] || [ -z "$base" ] || echo "VISUALCI_BASE_BRANCH=$base"
} >> "$GITHUB_ENV"
if git rev-parse --git-dir >/dev/null 2>&1; then
ref="$HEAD_SHA"
Expand Down
Loading
Loading