Skip to content

Commit 286b189

Browse files
authored
ci: add beta release support (#1536)
<!-- πŸ‘‹ Hi, thanks for sending a PR to eslint-plugin-package-json! πŸ—‚ Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [x] Addresses an existing open issue: fixes #1528 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/.github/CONTRIBUTING.md) were taken ## Overview This change brings over the changes from `package-json-validator` for supporting prerelease publishing from the `beta` branch. This relies on a dedicated release-please config for each release branch, and logic to detect which dist-tag to publish to
1 parent 60304d9 commit 286b189

File tree

4 files changed

+59
-3
lines changed

4 files changed

+59
-3
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"changelog-sections": [
3+
{ "type": "feat", "section": "Features", "hidden": false },
4+
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
5+
{
6+
"type": "perf",
7+
"section": "Performance Improvements",
8+
"hidden": false
9+
},
10+
{ "type": "build", "hidden": true },
11+
{ "type": "chore", "hidden": true },
12+
{ "type": "ci", "hidden": true },
13+
{ "type": "docs", "hidden": true },
14+
{ "type": "refactor", "hidden": true },
15+
{ "type": "test", "hidden": true }
16+
],
17+
"include-component-in-tag": false,
18+
"prerelease": true,
19+
"prerelease-type": "beta",
20+
"release-type": "node",
21+
"packages": {
22+
".": {}
23+
},
24+
"versioning": "prerelease"
25+
}
File renamed without changes.
File renamed without changes.

β€Ž.github/workflows/release.ymlβ€Ž

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Release
33
on:
44
push:
55
branches:
6+
- beta
67
- main
78

89
concurrency:
@@ -16,18 +17,48 @@ jobs:
1617
pull-requests: write
1718
id-token: write # Required for OIDC
1819
outputs:
20+
dist_tag: ${{ steps.determine_dist_tag.outputs.dist_tag }}
1921
releases_created: ${{ steps.release.outputs.releases_created }}
2022
steps:
2123
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
2224
id: release
25+
with:
26+
config-file: .github/release-please/release-please-config.${{ github.ref_name }}.json
27+
manifest-file: .github/release-please/release-please-manifest.json
28+
target-branch: ${{ github.ref_name }}
29+
2330
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2431
if: ${{ steps.release.outputs.release_created }}
32+
2533
- uses: ./.github/actions/prepare
2634
if: ${{ steps.release.outputs.release_created }}
27-
- run: |
35+
36+
- name: Determine dist-tag
37+
id: determine_dist_tag
38+
if: ${{ steps.release.outputs.release_created }}
39+
run: |
40+
TAG_NAME="${{ steps.release.outputs.tag_name }}"
41+
echo "Release tag: $TAG_NAME"
42+
43+
if [[ "$TAG_NAME" == *"-alpha."* ]]; then
44+
DIST_TAG=alpha
45+
elif [[ "$TAG_NAME" == *"-beta."* ]]; then
46+
DIST_TAG=beta
47+
elif [[ "$TAG_NAME" == *"-rc."* ]]; then
48+
DIST_TAG=rc
49+
elif [[ "$TAG_NAME" == *"-"* ]]; then
50+
DIST_TAG=next
51+
else
52+
DIST_TAG=latest
53+
fi
54+
55+
echo "dist_tag=$DIST_TAG" >> "$GITHUB_OUTPUT"
56+
57+
- name: Build and Publish
58+
if: ${{ steps.release.outputs.release_created }}
59+
run: |
2860
pnpm build
2961
pnpm publish
30-
if: ${{ steps.release.outputs.release_created }}
3162
3263
post_release:
3364
needs: release_please
@@ -50,6 +81,6 @@ jobs:
5081
The release is available on:
5182
5283
* [GitHub releases](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/releases/tag/{release_tag})
53-
* [npm package (@latest dist-tag)](https://www.npmjs.com/package/eslint-plugin-package-json/v/${{ env.npm_version }})
84+
* [npm package (@${{ needs.release_please.outputs.dist_tag }} dist-tag)](https://www.npmjs.com/package/eslint-plugin-package-json/v/${{ env.npm_version }})
5485
5586
Cheers! πŸ“¦πŸš€

0 commit comments

Comments
Β (0)