feat: add memory commands (#141) #52
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
| name: Auto Release | |
| # Triggers when a version bump commit lands on main (from a merged release PR) | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'pyproject.toml' | |
| permissions: | |
| contents: write | |
| actions: write | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_release: ${{ steps.check.outputs.should_release }} | |
| version: ${{ steps.check.outputs.version }} | |
| tag: ${{ steps.check.outputs.tag }} | |
| is_prerelease: ${{ steps.check.outputs.is_prerelease }} | |
| steps: | |
| - name: Check if this is a version bump commit | |
| id: check | |
| env: | |
| COMMIT_MSG: ${{ github.event.head_commit.message }} | |
| run: | | |
| if [[ "$COMMIT_MSG" =~ ^chore:\ bump\ version\ to\ ([0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?) ]]; then | |
| VERSION="${BASH_REMATCH[1]}" | |
| echo "should_release=true" >> "$GITHUB_OUTPUT" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" | |
| if [[ "$VERSION" =~ rc ]]; then | |
| echo "is_prerelease=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "is_prerelease=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| echo "Detected release: $VERSION" | |
| else | |
| echo "should_release=false" >> "$GITHUB_OUTPUT" | |
| echo "Not a version bump commit, skipping." | |
| fi | |
| create-release: | |
| needs: check | |
| if: needs.check.outputs.should_release == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check tag doesn't already exist | |
| run: | | |
| if git ls-remote --tags origin | grep -q "refs/tags/${{ needs.check.outputs.tag }}$"; then | |
| echo "Tag ${{ needs.check.outputs.tag }} already exists!" | |
| exit 1 | |
| fi | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| PRERELEASE_FLAG="" | |
| NOTES_START_FLAG="" | |
| if [[ "${{ needs.check.outputs.is_prerelease }}" == "true" ]]; then | |
| PRERELEASE_FLAG="--prerelease" | |
| else | |
| # Span notes from the previous stable release so changes that | |
| # landed in intermediate RCs are included in the stable changelog. | |
| PREV_STABLE="$(gh release list --exclude-pre-releases --exclude-drafts --limit 1 --json tagName --jq '.[0].tagName')" | |
| if [[ -n "$PREV_STABLE" ]]; then | |
| NOTES_START_FLAG="--notes-start-tag $PREV_STABLE" | |
| fi | |
| fi | |
| gh release create "${{ needs.check.outputs.tag }}" \ | |
| --target "${{ github.sha }}" \ | |
| --title "${{ needs.check.outputs.tag }}" \ | |
| --generate-notes \ | |
| $NOTES_START_FLAG \ | |
| $PRERELEASE_FLAG | |
| - name: Trigger downstream workflows | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh workflow run release.yml -f tag=${{ needs.check.outputs.tag }} | |
| gh workflow run publish.yml |