Skip to content
Open
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
3 changes: 2 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"updateInternalDependencies": "patch",
"fixed": [],
"linked": [],
"ignore": []
"ignore": [],
"privatePackages": { "version": true, "tag": false }
}
4 changes: 3 additions & 1 deletion .github/comment-on-release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ Add this step to your `.github/workflows/release.yml` file after the `changesets

- name: Comment on PRs about release
if: steps.changesets.outputs.published == 'true'
uses: TanStack/config/.github/comment-on-release@main
uses: TanStack/config/.github/comment-on-release@<commit-sha> # v1.0.0
with:
published-packages: ${{ steps.changesets.outputs.published-packages }}
```

Use the commit and version of the latest "Actions vX.Y.Z" [release](https://github.com/TanStack/config/releases).

## Requirements

- Must be using [Changesets](https://github.com/changesets/changesets) for releases
Expand Down
6 changes: 6 additions & 0 deletions .github/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@tanstack/config-actions",
"version": "1.0.0",
"private": true,
"description": "Version of the shared GitHub Actions in this directory."
}
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,14 @@ jobs:
uses: $/.github/comment-on-release
with:
published-packages: ${{ steps.changesets.outputs.published-packages }}
- name: Release Actions
if: github.ref == 'refs/heads/main'
env:
GH_TOKEN: ${{ github.token }}
run: |
# Release the commit on main that set the version. The checkout may
# hold a version that Changesets bumped for the version PR.
sha="$(git log -1 --format=%H "$GITHUB_SHA" -- .github/package.json)"
Comment thread
schiller-manuel marked this conversation as resolved.
Resolved
tag="v$(git show "$sha:.github/package.json" | jq -r .version)"
gh release view "$tag" > /dev/null 2>&1 ||
gh release create "$tag" --target "$sha" --title "Actions $tag" --notes "Pin the actions as @$sha # $tag" --latest=false
28 changes: 28 additions & 0 deletions docs/ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,34 @@ title: CI/CD
- Runs tests for code merged into release branches
- Runs `nx run-many`, which executes all tasks and ensures the outputs are present (necessary for publishing builds)
- Uses [Changesets](https://github.com/changesets/changesets) to handle versioning and publishing
- Creates a `vX.Y.Z` release for the shared actions when their version changes

## Shared Actions

Other TanStack repositories use three composite actions from this repository:

- `.github/setup`: sets up Node and pnpm
- `.github/changeset-preview`: comments on a pull request with the versions Changesets would release
- `.github/comment-on-release`: comments on pull requests and linked issues once they are released

The three actions share one version. Pin them to the commit of a release and put the release tag in the comment:

```yaml
- name: Setup Tools
uses: TanStack/config/.github/setup@<commit-sha> # v1.0.0
```

Each "Actions vX.Y.Z" [release](https://github.com/TanStack/config/releases) lists the commit to pin. Renovate updates the commit and the comment together when a new release exists.

Do not put `# main` in the comment. zizmor checks that the ref in the comment still points at the pinned commit, and `main` moves with every package release.

### Releasing the Actions

Changesets versions the actions as the private package `@tanstack/config-actions` in `.github/package.json`. When you change an action, add a changeset for that package. After the "Version Packages" pull request is merged, `release.yml` creates the `vX.Y.Z` release for the new version.

Changesets would tag the package as `@tanstack/config-actions@X.Y.Z`, and Renovate does not read that as a version. The workflow creates the plain `vX.Y.Z` tag for that reason.

Release tags are immutable. Do not add a moving `v1` tag: a `# v1` comment would fail zizmor every time the tag moves.

## Nx

Expand Down
1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ linkWorkspacePackages: true
preferWorkspacePackages: true

packages:
- .github
- integrations/*
- packages/*

Expand Down
Loading