Skip to content

Commit 6db3fcc

Browse files
authored
ci: update bundle only on release branches (#84)
* ci: update bundle only on release branches * add doc with release instructions
1 parent a1ab43c commit 6db3fcc

4 files changed

Lines changed: 137 additions & 13 deletions

File tree

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Auto Package
1+
name: Auto Bundler
22

33
on:
44
pull_request:
@@ -15,13 +15,11 @@ permissions:
1515
pull-requests: write
1616

1717
jobs:
18-
auto-package:
19-
name: Auto Package Dependabot PR
18+
auto-bundler:
19+
name: Auto Bundler
2020
runs-on: ubuntu-latest
21-
# Run on Dependabot PRs or manual triggers
22-
if:
23-
github.actor == 'dependabot[bot]' || github.event_name ==
24-
'workflow_dispatch'
21+
# Run only on release branches
22+
if: startsWith(github.head_ref, 'release/')
2523
steps:
2624
- name: Harden Runner
2725
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
@@ -46,8 +44,8 @@ jobs:
4644
- name: Install Dependencies
4745
run: bun install
4846

49-
- name: Run Packaging
50-
run: bun run package
47+
- name: Run bundle
48+
run: bun run bundle
5149

5250
- name: Check for changes
5351
id: check-changes
@@ -64,15 +62,15 @@ jobs:
6462
git config --global user.name 'github-actions[bot]'
6563
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
6664
git add .
67-
git commit -m "chore: update package after dependency updates"
65+
git commit -m "chore: update for release"
6866
git push
6967
7068
- name: Add label to PR
7169
if: steps.check-changes.outputs.has_changes == 'true'
7270
env:
7371
PR_URL: ${{github.event.pull_request.html_url}}
7472
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75-
run: gh pr edit "$PR_URL" --add-label "auto-package"
73+
run: gh pr edit "$PR_URL" --add-label "auto-bundler"
7674

7775
- name: Add comment to PR
7876
if: steps.check-changes.outputs.has_changes == 'true'
@@ -84,5 +82,5 @@ jobs:
8482
issue_number: context.issue.number,
8583
owner: context.repo.owner,
8684
repo: context.repo.repo,
87-
body: '👋 I just pushed packaging updates after the dependency changes. Please verify the changes!'
85+
body: '👋 I just pushed updates to the PR. Please verify the changes!'
8886
})

.github/workflows/check-dist.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424
check-dist:
2525
name: Check dist/
2626
runs-on: ubuntu-latest
27-
27+
# Run only on release branches
28+
if: startsWith(github.head_ref, 'release/')
2829
steps:
2930
- name: Harden Runner
3031
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ the output looks like.
2929
If you would like to contribute to the development of this GitHub Action, see
3030
[docs/development.md](docs/development.md).
3131

32+
## Releasing
33+
34+
For maintainers looking to release a new version of this action, see
35+
[docs/release.md](docs/release.md) for detailed release instructions.
36+
3237
## How to set up the NEON_API_KEY
3338

3439
Using the action requires adding a Neon API key to your GitHub Secrets. There

docs/release.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# 🚀 Releasing a New Version of the Neon Schema Diff Action
2+
3+
This document provides step-by-step instructions for maintainers to release a
4+
new version of the Neon Schema Diff Action.
5+
6+
## Prerequisites
7+
8+
- Write access to the repository
9+
- Git configured with appropriate credentials
10+
- Node.js 21+ installed
11+
- Bun package manager installed
12+
13+
## Release Process
14+
15+
### 1. Create a Release Branch
16+
17+
Create a new branch following the naming convention `release/X.Y.Z`:
18+
19+
```bash
20+
git checkout main
21+
git pull origin main
22+
git checkout -b release/X.Y.Z
23+
```
24+
25+
Replace `X.Y.Z` with the appropriate semantic version number (e.g.,
26+
`release/1.2.0`).
27+
28+
### 2. Update Version Number
29+
30+
Update the `version` attribute in `package.json`:
31+
32+
```json
33+
{
34+
"version": "X.Y.Z"
35+
}
36+
```
37+
38+
### 3. Development Setup and Verification
39+
40+
Follow the same steps described in the
41+
[development documentation](./development.md):
42+
43+
#### Install Dependencies
44+
45+
```bash
46+
bun install
47+
```
48+
49+
#### Run Tests
50+
51+
```bash
52+
bun run test
53+
```
54+
55+
Ensure all tests pass before proceeding.
56+
57+
#### Verify Action Locally
58+
59+
```bash
60+
cp .env.example .env
61+
# Configure your environment variables in .env
62+
bun run local-action
63+
```
64+
65+
Test the action thoroughly to ensure it works as expected with the new version.
66+
67+
#### Package TypeScript for Distribution
68+
69+
```bash
70+
bun run bundle
71+
```
72+
73+
### 4. Create Pull Request
74+
75+
1. Commit your changes:
76+
77+
```bash
78+
git add .
79+
git commit -m "build: bump version to X.Y.Z"
80+
git push origin release/X.Y.Z
81+
```
82+
83+
2. Create a pull request from `release/X.Y.Z` to `main` branch
84+
3. Ensure all CI checks pass
85+
4. Get the pull request reviewed and approved
86+
5. Merge the pull request to `main`
87+
88+
### 5. Create Git Tags
89+
90+
After the PR is merged, create the necessary Git tags:
91+
92+
```bash
93+
git checkout main
94+
git pull origin main
95+
96+
# Create the specific version tag
97+
git tag vX.Y.Z
98+
git push origin vX.Y.Z
99+
100+
# Update the major version tag (e.g., v1, v2, etc.)
101+
git tag -f vX
102+
git push origin vX --force
103+
```
104+
105+
**Note**: The major version tag (e.g., `v1`) allows users to reference the
106+
latest version within that major release automatically.
107+
108+
### 6. Create GitHub Release
109+
110+
Follow the
111+
[GitHub documentation for creating releases](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release):
112+
113+
1. Navigate to the repository on GitHub
114+
2. Click **Releases** on the right side of the repository page
115+
3. Click **Draft a new release**
116+
4. Configure the release:
117+
- **Choose a tag**: Select `vX.Y.Z` (the tag you just created)
118+
- **Release title**: `vX.Y.Z`
119+
- **Description**: Generate release notes
120+
5. Click **Publish release**

0 commit comments

Comments
 (0)