Repository navigation
feat: v0.2.0 three commands, three config blocks #2
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # A merge that changes the version IS the release. When main's pyproject.toml | ||
| # names a version with a CHANGELOG heading and no tag yet, this tags it, and the | ||
| # tag push runs container.yml, which promotes the image to that version and then | ||
| # opens a bump PR in every repo that pins python-sdlc. | ||
| # | ||
| # Without this, a tool update that merged itself would sit untagged until a | ||
| # person noticed, and no repo would receive it. | ||
|
|
||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: release | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Tag a new version | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
|
|
||
| - name: Is there an untagged version? | ||
| id: version | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| set -eu | ||
| v=$(sed -n 's/^version = "\(.*\)"$/\1/p' pyproject.toml | head -1) | ||
| [ -n "$v" ] || { echo "pyproject.toml names no version" >&2; exit 1; } | ||
| if gh release view "v$v" >/dev/null 2>&1; then | ||
| echo "v$v is already released" | ||
| echo "tag=" >> "$GITHUB_OUTPUT" | ||
| elif grep -q "^## \[$v\]" CHANGELOG.md; then | ||
| echo "tag=v$v" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "v$v has no CHANGELOG heading; not releasing" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # The App's token, because a tag created with GITHUB_TOKEN does not start | ||
| # container.yml, and the release would never be promoted. | ||
| - name: Mint CI token | ||
| if: steps.version.outputs.tag != '' | ||
| id: ci-token | ||
| uses: actions/create-github-app-token@v3 | ||
| with: | ||
| app-id: ${{ vars.CRUNCHTOOLS_CI_APP_ID || secrets.CRUNCHTOOLS_CI_APP_ID }} | ||
| private-key: ${{ secrets.CRUNCHTOOLS_CI_APP_KEY }} | ||
| owner: crunchtools | ||
|
|
||
| - name: Release | ||
| if: steps.version.outputs.tag != '' | ||
| env: | ||
| GH_TOKEN: ${{ steps.ci-token.outputs.token }} | ||
| TAG: ${{ steps.version.outputs.tag }} | ||
| run: | | ||
| set -eu | ||
| v=${TAG#v} | ||
| notes=$(awk -v h="## [$v]" 'index($0, h) == 1 {f=1; next} f && /^## \[/ {exit} f' CHANGELOG.md) | ||
| gh release create "$TAG" --target "$GITHUB_SHA" --title "$TAG" --notes "$notes" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # A Gourmand or Gatehouse release reaches every Python repo in three steps, and | ||
| # this is the first: move the pin and bump this image's patch version, as a pull | ||
| # request that merges itself when CI is green. | ||
| # | ||
| # 1. this workflow new tool release -> PR moving the pin here | ||
| # 2. release.yml that PR merges -> python-sdlc vX.Y.Z is released | ||
| # 3. container.yml the release is promoted -> a bump PR in every repo | ||
| # that pins python-sdlc (scripts/bump_consumers.py) | ||
| # | ||
| # Gourmand and Gatehouse send `parent-image-updated` when they release. The | ||
| # weekly run catches a dispatch that was lost. | ||
|
|
||
| name: Update baked tools | ||
|
|
||
| on: | ||
| repository_dispatch: | ||
| types: [parent-image-updated] | ||
| schedule: | ||
| - cron: "0 7 * * 1" | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: update-tools | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| update: | ||
| name: Move the Gourmand and Gatehouse pins | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| # The crunchtools-ci App's token, not GITHUB_TOKEN: a pull request opened | ||
| # with GITHUB_TOKEN does not trigger CI, so it could never turn green and | ||
| # merge itself. | ||
| - name: Mint CI token | ||
| id: ci-token | ||
| uses: actions/create-github-app-token@v3 | ||
| with: | ||
| app-id: ${{ vars.CRUNCHTOOLS_CI_APP_ID || secrets.CRUNCHTOOLS_CI_APP_ID }} | ||
| private-key: ${{ secrets.CRUNCHTOOLS_CI_APP_KEY }} | ||
| owner: crunchtools | ||
|
|
||
| - uses: actions/checkout@v7 | ||
| with: | ||
| token: ${{ steps.ci-token.outputs.token }} | ||
|
|
||
| - name: Compare the pins to the latest releases | ||
| id: update | ||
| env: | ||
| GH_TOKEN: ${{ steps.ci-token.outputs.token }} | ||
| run: python3 scripts/update_tools.py | ||
|
|
||
| - name: Open the pull request and let it merge itself | ||
| if: steps.update.outputs.changed == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ steps.ci-token.outputs.token }} | ||
| VERSION: ${{ steps.update.outputs.version }} | ||
| SUMMARY: ${{ steps.update.outputs.summary }} | ||
| run: | | ||
| set -eu | ||
| branch="chore/tools-$VERSION" | ||
| git switch -c "$branch" | ||
| git -c user.name=crunchtools-ci -c user.email=ci@crunchtools.com \ | ||
| commit -qam "chore: python-sdlc $VERSION ($SUMMARY)" | ||
| git push -q -u origin "$branch" | ||
| url=$(gh pr create --head "$branch" --title "chore: python-sdlc $VERSION" \ | ||
| --body "Moves the baked tool pins: $SUMMARY. Merging releases python-sdlc $VERSION, which opens a bump PR in every repo that pins it.") | ||
| gh pr merge "$url" --auto --merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
LOW (General Review): This suppresses every error from
gh release view, making an existing release indistinguishable from an authentication, API, or network failure. The workflow then proceeds as though the version were untagged, obscuring the original failure and potentially producing a less informative error later.Suggestion: Capture the command result and treat only a confirmed not-found response as an untagged version; report or fail on other errors.
Evidence: