@oorabona/release-it-preset 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +402 -62
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,24 @@ Shared [release-it](https://github.com/release-it/release-it) configuration and
|
|
|
9
9
|
[](https://www.typescriptlang.org/)
|
|
10
10
|
[](https://opensource.org/licenses/MIT)
|
|
11
11
|
|
|
12
|
+
## Table of Contents
|
|
13
|
+
|
|
14
|
+
- [Features](#features)
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [Quick Start](#quick-start)
|
|
17
|
+
- [Available Configurations](#available-configurations)
|
|
18
|
+
- [CLI Usage](#cli-usage)
|
|
19
|
+
- [Scripts](#scripts)
|
|
20
|
+
- [Environment Variables](#environment-variables)
|
|
21
|
+
- [Configuration Override](#configuration-override)
|
|
22
|
+
- [Borrowing Scripts & Workflows](#borrowing-scripts--workflows)
|
|
23
|
+
- [Release Workflow](#release-workflow)
|
|
24
|
+
- [GitHub Actions Workflows](#github-actions-workflows)
|
|
25
|
+
- [Reusable Workflows](#reusable-workflows)
|
|
26
|
+
- [Workflow Reference](#workflow-reference)
|
|
27
|
+
- [Best Practices](#best-practices)
|
|
28
|
+
- [Troubleshooting](#troubleshooting)
|
|
29
|
+
|
|
12
30
|
## Features
|
|
13
31
|
|
|
14
32
|
- 📦 Multiple release configurations for different scenarios
|
|
@@ -87,8 +105,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
87
105
|
|
|
88
106
|
## GitHub Actions
|
|
89
107
|
|
|
90
|
-
|
|
108
|
+
### Quick Start: Reusable Workflows
|
|
109
|
+
|
|
110
|
+
Import pre-configured workflows into your repository:
|
|
91
111
|
|
|
112
|
+
**PR Validation:**
|
|
92
113
|
```yaml
|
|
93
114
|
name: PR Checks
|
|
94
115
|
|
|
@@ -96,16 +117,40 @@ on:
|
|
|
96
117
|
pull_request:
|
|
97
118
|
types: [opened, synchronize, reopened]
|
|
98
119
|
|
|
120
|
+
permissions:
|
|
121
|
+
contents: read
|
|
122
|
+
pull-requests: write
|
|
123
|
+
|
|
99
124
|
jobs:
|
|
100
125
|
validate:
|
|
101
126
|
uses: oorabona/release-it-preset/.github/workflows/reusable-verify.yml@main
|
|
102
127
|
with:
|
|
103
128
|
base-ref: origin/${{ github.base_ref }}
|
|
104
129
|
head-ref: ${{ github.sha }}
|
|
130
|
+
run-tests: true
|
|
105
131
|
secrets: inherit
|
|
106
132
|
```
|
|
107
133
|
|
|
108
|
-
|
|
134
|
+
**Publish on Tag:**
|
|
135
|
+
```yaml
|
|
136
|
+
name: Publish
|
|
137
|
+
|
|
138
|
+
on:
|
|
139
|
+
push:
|
|
140
|
+
tags: ['v*']
|
|
141
|
+
|
|
142
|
+
permissions:
|
|
143
|
+
contents: write
|
|
144
|
+
id-token: write
|
|
145
|
+
|
|
146
|
+
jobs:
|
|
147
|
+
publish:
|
|
148
|
+
uses: oorabona/release-it-preset/.github/workflows/publish.yml@main
|
|
149
|
+
secrets:
|
|
150
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
📖 **[Full Reusable Workflows Documentation](examples/reusable-workflows.md)** | 📚 **[CI/CD Integration Examples](examples/ci-integration.md)**
|
|
109
154
|
|
|
110
155
|
## Available Configurations
|
|
111
156
|
|
|
@@ -665,18 +710,154 @@ jobs:
|
|
|
665
710
|
|
|
666
711
|
This repository includes several GitHub Actions workflows for automated CI/CD and release management.
|
|
667
712
|
|
|
668
|
-
###
|
|
713
|
+
### Reusable Workflows
|
|
714
|
+
|
|
715
|
+
Two workflows are designed for reuse in your own projects:
|
|
716
|
+
|
|
717
|
+
#### 🔄 `reusable-verify.yml` - PR Validation & Hygiene Checks
|
|
718
|
+
|
|
719
|
+
Validates TypeScript compilation, runs tests, checks release readiness, and evaluates PR hygiene (changelog updates, conventional commits).
|
|
720
|
+
|
|
721
|
+
**When to use:** Import this workflow in your PR validation to ensure code quality and release readiness.
|
|
722
|
+
|
|
723
|
+
**Inputs:**
|
|
724
|
+
|
|
725
|
+
| Input | Type | Default | Description |
|
|
726
|
+
|-------|------|---------|-------------|
|
|
727
|
+
| `node-version` | string | `'20'` | Node.js version to use |
|
|
728
|
+
| `run-tests` | boolean | `false` | Run `pnpm test` after compilation |
|
|
729
|
+
| `base-ref` | string | `''` | Base ref for diff comparisons (e.g., `origin/main`) |
|
|
730
|
+
| `head-ref` | string | `'HEAD'` | Head ref for comparisons |
|
|
731
|
+
| `install-args` | string | `'--frozen-lockfile'` | Additional pnpm install arguments |
|
|
732
|
+
| `fetch-depth` | number | `0` | Git fetch depth for checkout |
|
|
733
|
+
|
|
734
|
+
**Outputs:**
|
|
735
|
+
|
|
736
|
+
| Output | Description |
|
|
737
|
+
|--------|-------------|
|
|
738
|
+
| `release_validation` | `'true'` when release validation passes |
|
|
739
|
+
| `changelog_status` | Changelog status: `updated`, `skipped`, or `missing` |
|
|
740
|
+
| `skip_changelog` | `'true'` when `[skip-changelog]` detected in commits |
|
|
741
|
+
| `conventional_commits` | `'true'` when conventional commits detected |
|
|
742
|
+
| `commit_messages` | Base64 encoded JSON array of analyzed commit messages |
|
|
743
|
+
| `changed_files` | Base64 encoded JSON array of changed files |
|
|
744
|
+
|
|
745
|
+
**Example usage in your project:**
|
|
746
|
+
|
|
747
|
+
```yaml
|
|
748
|
+
# .github/workflows/validate-pr.yml
|
|
749
|
+
name: PR Validation
|
|
750
|
+
|
|
751
|
+
on:
|
|
752
|
+
pull_request:
|
|
753
|
+
types: [opened, synchronize, reopened]
|
|
754
|
+
|
|
755
|
+
jobs:
|
|
756
|
+
validate:
|
|
757
|
+
uses: oorabona/release-it-preset/.github/workflows/reusable-verify.yml@main
|
|
758
|
+
with:
|
|
759
|
+
node-version: '20'
|
|
760
|
+
base-ref: origin/${{ github.base_ref }}
|
|
761
|
+
head-ref: ${{ github.sha }}
|
|
762
|
+
run-tests: true
|
|
763
|
+
secrets: inherit
|
|
764
|
+
|
|
765
|
+
comment:
|
|
766
|
+
needs: validate
|
|
767
|
+
runs-on: ubuntu-latest
|
|
768
|
+
if: always()
|
|
769
|
+
permissions:
|
|
770
|
+
pull-requests: write
|
|
771
|
+
steps:
|
|
772
|
+
- uses: actions/github-script@v7
|
|
773
|
+
with:
|
|
774
|
+
script: |
|
|
775
|
+
const summary = `## 📋 PR Validation
|
|
776
|
+
|
|
777
|
+
${needs.validate.outputs.release_validation === 'true' ? '✅' : '⚠️'} Release validation
|
|
778
|
+
${needs.validate.outputs.changelog_status === 'updated' ? '✅' : 'ℹ️'} Changelog: ${needs.validate.outputs.changelog_status}
|
|
779
|
+
${needs.validate.outputs.conventional_commits === 'true' ? '✅' : 'ℹ️'} Conventional commits
|
|
780
|
+
`;
|
|
781
|
+
|
|
782
|
+
github.rest.issues.createComment({
|
|
783
|
+
owner: context.repo.owner,
|
|
784
|
+
repo: context.repo.repo,
|
|
785
|
+
issue_number: context.issue.number,
|
|
786
|
+
body: summary
|
|
787
|
+
});
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
#### 🔄 `build-dist.yml` - Build Compiled Distribution
|
|
791
|
+
|
|
792
|
+
Builds TypeScript sources to `dist/` and uploads as artifact for reuse in other jobs.
|
|
793
|
+
|
|
794
|
+
**When to use:** When you need compiled outputs across multiple jobs without rebuilding.
|
|
795
|
+
|
|
796
|
+
**Inputs:**
|
|
797
|
+
|
|
798
|
+
| Input | Type | Default | Description |
|
|
799
|
+
|-------|------|---------|-------------|
|
|
800
|
+
| `artifact_name` | string | `'dist-build'` | Name for the uploaded dist artifact |
|
|
801
|
+
| `ref` | string | (current) | Optional git ref to checkout before building |
|
|
669
802
|
|
|
670
|
-
|
|
803
|
+
**Outputs:**
|
|
671
804
|
|
|
672
|
-
|
|
805
|
+
| Output | Description |
|
|
806
|
+
|--------|-------------|
|
|
807
|
+
| `artifact_name` | Name of the uploaded dist artifact |
|
|
673
808
|
|
|
674
|
-
**
|
|
809
|
+
**Example usage in your project:**
|
|
810
|
+
|
|
811
|
+
```yaml
|
|
812
|
+
# .github/workflows/ci.yml
|
|
813
|
+
jobs:
|
|
814
|
+
build:
|
|
815
|
+
uses: oorabona/release-it-preset/.github/workflows/build-dist.yml@main
|
|
816
|
+
with:
|
|
817
|
+
artifact_name: my-dist
|
|
818
|
+
ref: ${{ github.sha }}
|
|
819
|
+
|
|
820
|
+
test:
|
|
821
|
+
needs: build
|
|
822
|
+
runs-on: ubuntu-latest
|
|
823
|
+
steps:
|
|
824
|
+
- uses: actions/checkout@v4
|
|
825
|
+
- uses: actions/download-artifact@v4
|
|
826
|
+
with:
|
|
827
|
+
name: ${{ needs.build.outputs.artifact_name }}
|
|
828
|
+
path: dist
|
|
829
|
+
- run: pnpm test
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
### Workflow Reference
|
|
833
|
+
|
|
834
|
+
#### Overview Table
|
|
835
|
+
|
|
836
|
+
| Workflow | Type | Trigger | Purpose |
|
|
837
|
+
|----------|------|---------|---------|
|
|
838
|
+
| 🔄 [reusable-verify.yml](#-reusable-verifyyml---pr-validation--hygiene-checks) | Reusable | `workflow_call` | PR validation & hygiene checks |
|
|
839
|
+
| 🔄 [build-dist.yml](#-build-distyml---build-compiled-distribution) | Reusable | `workflow_call` | Build TypeScript distribution |
|
|
840
|
+
| ⚙️ [ci.yml](#1-️-ci-github-workflowsciyml) | Standalone | Push, PR, Manual | Continuous Integration |
|
|
841
|
+
| ✅ [validate-pr.yml](#2--validate-pr-github-workflowsvalidate-pryml) | Standalone | PR | Pull request validation |
|
|
842
|
+
| 🚨 [hotfix.yml](#3--hotfix-release-github-workflowshotfixyml) | Manual | `workflow_dispatch` | Emergency hotfix releases |
|
|
843
|
+
| 🔄 [retry-publish.yml](#4--retry-publish-github-workflowsretry-publishyml) | Manual | `workflow_dispatch` | Retry failed publishing |
|
|
844
|
+
| ⚠️ [republish.yml](#5-️-republish-exceptional-github-workflowsrepublishyml) | Manual | `workflow_dispatch` | Republish existing version |
|
|
845
|
+
| 📦 [publish.yml](#6--publish-github-workflowspublishyml) | Reusable | Tag push, `workflow_call` | Automated publishing |
|
|
846
|
+
|
|
847
|
+
You can copy these workflows into your own repository (adjusting names, branches, and secrets to match your context). They work with the release-it-preset CLI defaults.
|
|
848
|
+
|
|
849
|
+
#### 1. ⚙️ **CI** (`.github/workflows/ci.yml`)
|
|
850
|
+
|
|
851
|
+
**Triggers:**
|
|
852
|
+
- Push to `main`
|
|
853
|
+
- Pull Requests to `main`
|
|
854
|
+
- Manual (`workflow_dispatch`)
|
|
675
855
|
|
|
676
856
|
**Jobs:**
|
|
677
|
-
-
|
|
678
|
-
-
|
|
679
|
-
-
|
|
857
|
+
- `build-dist` - Builds compiled distribution using reusable workflow
|
|
858
|
+
- `tests` - Runs unit tests with coverage
|
|
859
|
+
- `test-cli` - Tests all CLI commands (help, check, validate, init)
|
|
860
|
+
- `release` - Manual release creation (workflow_dispatch only)
|
|
680
861
|
|
|
681
862
|
**Manual Release:**
|
|
682
863
|
```bash
|
|
@@ -684,88 +865,247 @@ You can copy these files into your own repository (adjusting names, branches, an
|
|
|
684
865
|
# Select increment type: patch, minor, or major
|
|
685
866
|
```
|
|
686
867
|
|
|
687
|
-
|
|
868
|
+
**Secrets required:**
|
|
869
|
+
- `NPM_TOKEN` - npm automation token (for release job)
|
|
870
|
+
- `CODECOV_TOKEN` - Codecov upload token (optional)
|
|
688
871
|
|
|
689
|
-
**
|
|
872
|
+
#### 2. ✅ **Validate PR** (`.github/workflows/validate-pr.yml`)
|
|
690
873
|
|
|
691
|
-
**
|
|
692
|
-
-
|
|
693
|
-
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
-
|
|
874
|
+
**Triggers:**
|
|
875
|
+
- Pull Request `opened`, `synchronize`, `reopened`
|
|
876
|
+
- Can be called as reusable workflow (`workflow_call`)
|
|
877
|
+
|
|
878
|
+
**Jobs:**
|
|
879
|
+
- `validate` - Uses `reusable-verify.yml` for hygiene checks
|
|
880
|
+
- `summarize` - Posts validation summary comment on PR
|
|
881
|
+
|
|
882
|
+
**What it checks:**
|
|
883
|
+
- ✅ TypeScript compilation
|
|
884
|
+
- ✅ Release validation (with `--allow-dirty`)
|
|
885
|
+
- ✅ CHANGELOG.md updates (or `[skip-changelog]` marker)
|
|
886
|
+
- ✅ Conventional commits format
|
|
887
|
+
- ✅ Commit messages analysis
|
|
888
|
+
|
|
889
|
+
**Permissions required:**
|
|
890
|
+
```yaml
|
|
891
|
+
permissions:
|
|
892
|
+
contents: read
|
|
893
|
+
pull-requests: write # For posting comments
|
|
894
|
+
```
|
|
697
895
|
|
|
698
|
-
**
|
|
699
|
-
- Ensuring PRs follow best practices
|
|
700
|
-
- Catching issues before merge
|
|
701
|
-
- Promoting conventional commits usage
|
|
896
|
+
**No secrets required** (uses `GITHUB_TOKEN` automatically)
|
|
702
897
|
|
|
703
|
-
#### 3. **Hotfix Release** (`.github/workflows/hotfix.yml`)
|
|
898
|
+
#### 3. 🚨 **Hotfix Release** (`.github/workflows/hotfix.yml`)
|
|
704
899
|
|
|
705
|
-
**Trigger:** Manual (workflow_dispatch)
|
|
900
|
+
**Trigger:** Manual (`workflow_dispatch`)
|
|
706
901
|
|
|
707
902
|
**Inputs:**
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
903
|
+
|
|
904
|
+
| Input | Type | Required | Default | Description |
|
|
905
|
+
|-------|------|----------|---------|-------------|
|
|
906
|
+
| `increment` | choice | ✅ | `patch` | Version bump: `patch` or `minor` |
|
|
907
|
+
| `commit` | string | ❌ | latest | Specific commit SHA to release |
|
|
908
|
+
| `dry_run` | boolean | ❌ | `false` | Test without actual publishing |
|
|
909
|
+
|
|
910
|
+
**Jobs:**
|
|
911
|
+
- `validate` - Validates TypeScript compilation and builds
|
|
912
|
+
- `hotfix` - Creates emergency hotfix release using `release-it-preset hotfix`
|
|
711
913
|
|
|
712
914
|
**What it does:**
|
|
713
|
-
|
|
714
|
-
-
|
|
715
|
-
|
|
716
|
-
|
|
915
|
+
1. Validates code at specified commit
|
|
916
|
+
2. Auto-generates changelog from recent commits
|
|
917
|
+
3. Creates hotfix release (patch/minor bump)
|
|
918
|
+
4. Pushes git tag (GitHub release + npm publish via `publish.yml`)
|
|
717
919
|
|
|
718
|
-
**When to use:**
|
|
719
|
-
Critical bugs that need immediate patch release.
|
|
920
|
+
**When to use:** Critical bugs needing immediate patch release
|
|
720
921
|
|
|
721
|
-
|
|
922
|
+
**Permissions required:**
|
|
923
|
+
```yaml
|
|
924
|
+
permissions:
|
|
925
|
+
contents: write # For git operations
|
|
926
|
+
id-token: write # For npm provenance
|
|
927
|
+
```
|
|
722
928
|
|
|
723
|
-
**
|
|
929
|
+
**Secrets required:**
|
|
930
|
+
- `NPM_TOKEN` - npm automation token
|
|
931
|
+
- `GITHUB_TOKEN` - Provided automatically
|
|
932
|
+
|
|
933
|
+
#### 4. 🔄 **Retry Publish** (`.github/workflows/retry-publish.yml`)
|
|
934
|
+
|
|
935
|
+
**Trigger:** Manual (`workflow_dispatch`)
|
|
724
936
|
|
|
725
937
|
**Inputs:**
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
938
|
+
|
|
939
|
+
| Input | Type | Required | Default | Description |
|
|
940
|
+
|-------|------|----------|---------|-------------|
|
|
941
|
+
| `tag_name` | string | ❌ | latest tag | Git tag to republish |
|
|
942
|
+
| `npm_only` | boolean | ❌ | `false` | Publish to npm only (skip GitHub Release) |
|
|
943
|
+
| `github_only` | boolean | ❌ | `false` | Create GitHub Release only (skip npm) |
|
|
944
|
+
|
|
945
|
+
**Jobs:**
|
|
946
|
+
- `determine-tag` - Validates and determines which tag to publish
|
|
947
|
+
- `build-dist` - Builds distribution using reusable workflow
|
|
948
|
+
- `retry-publish` - Republishes to npm and/or GitHub
|
|
729
949
|
|
|
730
950
|
**What it does:**
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
951
|
+
1. Verifies git tag exists
|
|
952
|
+
2. Runs pre-flight checks (`retry-publish.js` script)
|
|
953
|
+
3. Republishes to selected destination(s)
|
|
954
|
+
4. Uses existing changelog for release notes
|
|
734
955
|
|
|
735
|
-
**When to use:**
|
|
736
|
-
When previous publish failed (network issue, auth problem, etc.)
|
|
956
|
+
**When to use:** Previous publish failed (network issue, auth problem, etc.)
|
|
737
957
|
|
|
738
|
-
|
|
958
|
+
**Permissions required:**
|
|
959
|
+
```yaml
|
|
960
|
+
permissions:
|
|
961
|
+
contents: write # For GitHub releases
|
|
962
|
+
id-token: write # For npm provenance
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
**Secrets required:**
|
|
966
|
+
- `NPM_TOKEN` - npm automation token (if npm publish enabled)
|
|
967
|
+
- `GITHUB_TOKEN` - Provided automatically
|
|
968
|
+
|
|
969
|
+
#### 5. ⚠️ **Republish (EXCEPTIONAL)** (`.github/workflows/republish.yml`)
|
|
739
970
|
|
|
740
|
-
**Trigger:** Manual (workflow_dispatch)
|
|
971
|
+
**Trigger:** Manual (`workflow_dispatch`)
|
|
972
|
+
|
|
973
|
+
**⚠️ DANGER:** Moves existing git tag (breaks semver immutability)
|
|
741
974
|
|
|
742
975
|
**Inputs:**
|
|
743
|
-
|
|
744
|
-
|
|
976
|
+
|
|
977
|
+
| Input | Type | Required | Description |
|
|
978
|
+
|-------|------|----------|-------------|
|
|
979
|
+
| `version` | string | ✅ | Version to republish (e.g., `1.2.3`) |
|
|
980
|
+
| `confirmation` | string | ✅ | Must type exactly `"I understand the risks"` |
|
|
981
|
+
|
|
982
|
+
**Jobs:**
|
|
983
|
+
- `pre-flight-checks` - Validates confirmation, version format, and tag existence
|
|
984
|
+
- `build-dist` - Builds distribution using reusable workflow
|
|
985
|
+
- `validate` - Validates TypeScript compilation
|
|
986
|
+
- `republish` - Moves git tag and republishes
|
|
745
987
|
|
|
746
988
|
**What it does:**
|
|
747
|
-
|
|
748
|
-
-
|
|
749
|
-
-
|
|
750
|
-
-
|
|
751
|
-
-
|
|
752
|
-
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
989
|
+
1. **Pre-flight safety checks:**
|
|
990
|
+
- Validates confirmation phrase
|
|
991
|
+
- Checks version format
|
|
992
|
+
- Verifies tag exists
|
|
993
|
+
- Displays warning message
|
|
994
|
+
- **10-second safety delay** ⏰
|
|
995
|
+
2. Validates code compilation
|
|
996
|
+
3. **Moves git tag to current commit** (⚠️ breaks immutability)
|
|
997
|
+
4. Updates changelog for current version
|
|
998
|
+
5. Republishes to npm with provenance
|
|
999
|
+
6. Updates GitHub Release
|
|
1000
|
+
7. Creates audit trail document
|
|
1001
|
+
|
|
1002
|
+
**When to use:** ONLY for exceptional emergencies where a published version has critical security issues
|
|
1003
|
+
|
|
1004
|
+
**Permissions required:**
|
|
1005
|
+
```yaml
|
|
1006
|
+
permissions:
|
|
1007
|
+
contents: write # For git tag operations
|
|
1008
|
+
id-token: write # For npm provenance
|
|
1009
|
+
```
|
|
1010
|
+
|
|
1011
|
+
**Secrets required:**
|
|
1012
|
+
- `NPM_TOKEN` - npm automation token
|
|
1013
|
+
- `GITHUB_TOKEN` - Provided automatically
|
|
1014
|
+
|
|
1015
|
+
**Concurrency:** Prevents parallel republish operations for same version
|
|
1016
|
+
|
|
1017
|
+
#### 6. 📦 **Publish** (`.github/workflows/publish.yml`)
|
|
756
1018
|
|
|
757
|
-
**
|
|
758
|
-
|
|
1019
|
+
**Triggers:**
|
|
1020
|
+
- Tag push matching `v*` pattern
|
|
1021
|
+
- Can be called as reusable workflow (`workflow_call`)
|
|
759
1022
|
|
|
760
|
-
|
|
1023
|
+
**Inputs (for `workflow_call`):**
|
|
761
1024
|
|
|
762
|
-
|
|
1025
|
+
| Input | Type | Required | Description |
|
|
1026
|
+
|-------|------|----------|-------------|
|
|
1027
|
+
| `tag` | string | ❌ | Override tag (auto-detected from `github.ref_name`) |
|
|
1028
|
+
|
|
1029
|
+
**Jobs:**
|
|
1030
|
+
- `build-dist` - Builds distribution using reusable workflow
|
|
1031
|
+
- `publish` - Updates GitHub release and publishes to npm
|
|
763
1032
|
|
|
764
1033
|
**What it does:**
|
|
765
|
-
|
|
766
|
-
|
|
1034
|
+
1. Builds compiled distribution
|
|
1035
|
+
2. Runs `release-it-preset retry-publish --ci`
|
|
1036
|
+
3. Creates/updates GitHub Release with changelog
|
|
1037
|
+
4. Publishes to npm with provenance attestation
|
|
1038
|
+
|
|
1039
|
+
**When it runs:** Automatically triggered when a tag is pushed (e.g., by `default` or `hotfix` workflows)
|
|
1040
|
+
|
|
1041
|
+
**Permissions required:**
|
|
1042
|
+
```yaml
|
|
1043
|
+
permissions:
|
|
1044
|
+
contents: write # For GitHub releases
|
|
1045
|
+
id-token: write # For npm provenance attestation
|
|
1046
|
+
```
|
|
767
1047
|
|
|
768
|
-
**
|
|
1048
|
+
**Secrets required (for `workflow_call`):**
|
|
1049
|
+
- `NPM_TOKEN` - npm automation token (must be passed explicitly)
|
|
1050
|
+
|
|
1051
|
+
**Secrets required (for tag push):**
|
|
1052
|
+
- `NPM_TOKEN` - npm automation token (repository secret)
|
|
1053
|
+
- `GITHUB_TOKEN` - Provided automatically
|
|
1054
|
+
|
|
1055
|
+
**Environment variables set:**
|
|
1056
|
+
- `GITHUB_RELEASE=true` - Enables GitHub release creation
|
|
1057
|
+
- `NPM_PUBLISH=true` - Enables npm publishing
|
|
1058
|
+
|
|
1059
|
+
---
|
|
1060
|
+
|
|
1061
|
+
### Workflows Summary Diagram
|
|
1062
|
+
|
|
1063
|
+
```mermaid
|
|
1064
|
+
graph TB
|
|
1065
|
+
subgraph "Reusable Workflows"
|
|
1066
|
+
RV[🔄 reusable-verify.yml<br/>PR validation & hygiene]
|
|
1067
|
+
BD[🔄 build-dist.yml<br/>Build TypeScript dist]
|
|
1068
|
+
end
|
|
1069
|
+
|
|
1070
|
+
subgraph "Development Flow"
|
|
1071
|
+
PR[Pull Request] --> VPR[✅ validate-pr.yml]
|
|
1072
|
+
VPR --> RV
|
|
1073
|
+
VPR --> Comment[Post PR comment]
|
|
1074
|
+
end
|
|
1075
|
+
|
|
1076
|
+
subgraph "Release Flow"
|
|
1077
|
+
Manual[Manual Trigger] --> CI[⚙️ ci.yml]
|
|
1078
|
+
CI --> BD
|
|
1079
|
+
CI --> Tag[Create Tag]
|
|
1080
|
+
Tag --> PUB[📦 publish.yml]
|
|
1081
|
+
PUB --> BD
|
|
1082
|
+
PUB --> NPM[npm publish]
|
|
1083
|
+
PUB --> GH[GitHub Release]
|
|
1084
|
+
end
|
|
1085
|
+
|
|
1086
|
+
subgraph "Emergency Flow"
|
|
1087
|
+
Critical[Critical Bug] --> HF[🚨 hotfix.yml]
|
|
1088
|
+
HF --> BD
|
|
1089
|
+
HF --> Tag
|
|
1090
|
+
end
|
|
1091
|
+
|
|
1092
|
+
subgraph "Recovery Flow"
|
|
1093
|
+
Failed[Failed Publish] --> RP[🔄 retry-publish.yml]
|
|
1094
|
+
RP --> BD
|
|
1095
|
+
RP --> Decision{Retry What?}
|
|
1096
|
+
Decision -->|npm only| NPM
|
|
1097
|
+
Decision -->|GitHub only| GH
|
|
1098
|
+
Decision -->|Both| Both[npm + GitHub]
|
|
1099
|
+
end
|
|
1100
|
+
|
|
1101
|
+
style RV fill:#e1f5fe
|
|
1102
|
+
style BD fill:#e1f5fe
|
|
1103
|
+
style VPR fill:#c8e6c9
|
|
1104
|
+
style CI fill:#fff9c4
|
|
1105
|
+
style HF fill:#ffccbc
|
|
1106
|
+
style RP fill:#b2ebf2
|
|
1107
|
+
style PUB fill:#d1c4e9
|
|
1108
|
+
```
|
|
769
1109
|
|
|
770
1110
|
## Best Practices
|
|
771
1111
|
|