-
Notifications
You must be signed in to change notification settings - Fork 3
feat: first release under versioning standard #681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a76ddc2
e669892
a6b937b
48305f2
85e626e
55f593c
2be9fbd
5f8ba47
9b32896
a0240bd
70fb779
f1d07e3
ff86895
95a28a5
bf3e0eb
6f9a710
c6164bb
69fb435
50647eb
f0e9ec9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| name: hotfix-start | ||
|
|
||
| # Creates a hotfix branch off a release tag per the Data Services Versioning | ||
| # Standard §10. Workflow: | ||
| # 1. Run this workflow (optionally pin base_tag; default = latest v*.*.*). | ||
| # 2. Push fix commit(s) to the new hotfix/vX.Y.(Z+1) branch via PR. | ||
| # 3. release-please opens a Release PR on the hotfix branch. | ||
| # 4. Merge it -> tag vX.Y.(Z+1) -> CD (Production) deploys. | ||
| # 5. Open a forward-merge PR from hotfix/vX.Y.(Z+1) back into production. | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| base_tag: | ||
| description: 'Release tag to branch from (e.g. v1.4.2). Empty = latest v*.*.* tag.' | ||
| required: false | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| create-hotfix-branch: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6.0.3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Resolve base tag | ||
| id: base | ||
| run: | | ||
| BASE="${{ inputs.base_tag }}" | ||
| if [ -z "$BASE" ]; then | ||
| BASE="$(git tag --list 'v*.*.*' --sort=-v:refname | head -n1)" | ||
| fi | ||
| if [ -z "$BASE" ]; then | ||
| echo "No release tag found (expected v*.*.* tags)." >&2 | ||
| exit 1 | ||
| fi | ||
| if ! git rev-parse -q --verify "refs/tags/$BASE" >/dev/null; then | ||
| echo "Tag $BASE not found in repo." >&2 | ||
| exit 1 | ||
| fi | ||
| echo "tag=$BASE" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Compute next PATCH version + branch name | ||
| id: next | ||
| run: | | ||
| BASE="${{ steps.base.outputs.tag }}" | ||
| VER="${BASE#v}" | ||
| IFS='.' read -r MAJ MIN PAT <<<"$VER" | ||
| if ! [[ "$MAJ" =~ ^[0-9]+$ && "$MIN" =~ ^[0-9]+$ && "$PAT" =~ ^[0-9]+$ ]]; then | ||
| echo "Base tag $BASE is not strict SemVer vX.Y.Z." >&2 | ||
| exit 1 | ||
| fi | ||
| NEXT_VER="${MAJ}.${MIN}.$((PAT+1))" | ||
| BRANCH="hotfix/v${NEXT_VER}" | ||
| echo "version=${NEXT_VER}" >> "$GITHUB_OUTPUT" | ||
| echo "branch=${BRANCH}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Guard against existing branch | ||
| run: | | ||
| if git ls-remote --exit-code --heads origin "${{ steps.next.outputs.branch }}" >/dev/null 2>&1; then | ||
| echo "Branch ${{ steps.next.outputs.branch }} already exists on origin. Aborting." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Create + push hotfix branch | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git checkout -b "${{ steps.next.outputs.branch }}" "${{ steps.base.outputs.tag }}" | ||
| git push origin "${{ steps.next.outputs.branch }}" | ||
|
|
||
| - name: Summary | ||
| run: | | ||
| { | ||
| echo "### Hotfix branch ready" | ||
| echo "" | ||
| echo "- Base tag: \`${{ steps.base.outputs.tag }}\`" | ||
| echo "- New branch: \`${{ steps.next.outputs.branch }}\`" | ||
| echo "- Target version: \`v${{ steps.next.outputs.version }}\`" | ||
| echo "" | ||
| echo "Next steps:" | ||
| echo "1. Open a fix PR targeting \`${{ steps.next.outputs.branch }}\` (Conventional Commit title, \`fix:\` prefix)." | ||
| echo "2. After merge, release-please will open a Release PR on the hotfix branch." | ||
| echo "3. Merge the Release PR -> tag \`v${{ steps.next.outputs.version }}\` -> CD (Production) deploys." | ||
| echo "4. Open a forward-merge PR \`${{ steps.next.outputs.branch }}\` -> \`production\`." | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: pr-title-lint | ||
|
|
||
| # Enforces Conventional Commits on PR titles so squash-merged commits drive | ||
| # release-please correctly. See Data Services Versioning Standard §7. | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, edited, reopened, synchronize] | ||
|
|
||
| permissions: | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: amannn/action-semantic-pull-request@v5 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| types: | | ||
| feat | ||
| fix | ||
| perf | ||
| docs | ||
| chore | ||
| refactor | ||
| test | ||
| ci | ||
| build | ||
| style | ||
| revert | ||
| deps | ||
|
Comment on lines
+21
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This new linter requires PR titles to start with one of these Conventional Commit types, but the existing Useful? React with 👍 / 👎. |
||
| requireScope: false | ||
| subjectPattern: ^(?![A-Z]).+$ | ||
| subjectPatternError: | | ||
| PR title subject must start with a lowercase letter. | ||
| Example: `feat: add /wells/{id}/assets endpoint` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: release-please | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - production | ||
| - 'hotfix/v*' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| release-please: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: googleapis/release-please-action@v4 | ||
| with: | ||
| config-file: release-please-config.json | ||
| manifest-file: .release-please-manifest.json | ||
| target-branch: ${{ github.ref_name }} |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| ".": "1.0.0" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
base_tagis omitted, this glob also matches prerelease tags such asv1.2.3-rc.1andv1.2.3rc1; this same change adds prerelease tagging/deployment paths, so the newest matching tag can easily be an RC. In that case the next step parsesPATas a non-numeric value like3-rc.1and aborts with “not strict SemVer,” making the default hotfix workflow fail until a GA tag is supplied manually. Filter to strictvX.Y.Ztags before sorting/selecting the default.Useful? React with 👍 / 👎.