chore: bump version to 0.5.1 #37
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: Release | |
| on: | |
| push: | |
| branches: [main] | |
| paths: [VERSION] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| preflight: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Read version | |
| id: version | |
| run: echo "version=$(cat VERSION | tr -d '[:space:]')" >> "$GITHUB_OUTPUT" | |
| - name: Check tag does not exist | |
| run: | | |
| if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then | |
| echo "::error::Tag v${{ steps.version.outputs.version }} already exists" | |
| exit 1 | |
| fi | |
| build: | |
| needs: preflight | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-latest | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push frontend image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/${{ matrix.arch }} | |
| push: true | |
| provenance: false | |
| build-args: | | |
| VITE_API_URL= | |
| tags: | | |
| ghcr.io/${{ github.repository }}:${{ needs.preflight.outputs.version }}-${{ matrix.arch }} | |
| labels: | | |
| org.opencontainers.image.source=https://github.com/${{ github.repository }} | |
| cache-from: type=gha,scope=${{ matrix.arch }} | |
| cache-to: type=gha,mode=max,scope=${{ matrix.arch }} | |
| manifest: | |
| needs: [build, preflight] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create multi-arch manifest | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${{ github.repository }}:${{ needs.preflight.outputs.version }} \ | |
| -t ghcr.io/${{ github.repository }}:latest \ | |
| ghcr.io/${{ github.repository }}:${{ needs.preflight.outputs.version }}-amd64 \ | |
| ghcr.io/${{ github.repository }}:${{ needs.preflight.outputs.version }}-arm64 | |
| release: | |
| needs: [manifest, preflight] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate release notes | |
| id: notes | |
| run: | | |
| VERSION="v${{ needs.preflight.outputs.version }}" | |
| PREV_TAG=$(git tag --sort=-v:refname | head -1) | |
| if [ -z "$PREV_TAG" ]; then | |
| COMMITS=$(git log --oneline --no-merges) | |
| else | |
| COMMITS=$(git log --oneline --no-merges ${PREV_TAG}..HEAD) | |
| fi | |
| # Categorize commits | |
| FEATURES=$(echo "$COMMITS" | grep -iE '^[a-f0-9]+ feat' | sed 's/^[a-f0-9]* /- /' || true) | |
| FIXES=$(echo "$COMMITS" | grep -iE '^[a-f0-9]+ fix' | sed 's/^[a-f0-9]* /- /' || true) | |
| OTHER=$(echo "$COMMITS" | grep -ivE '^[a-f0-9]+ (feat|fix|release|Revert)' | sed 's/^[a-f0-9]* /- /' || true) | |
| REVERTS=$(echo "$COMMITS" | grep -iE '^[a-f0-9]+ Revert' | sed 's/^[a-f0-9]* /- /' || true) | |
| { | |
| echo "body<<RELEASE_EOF" | |
| echo "## What's Changed" | |
| echo "" | |
| if [ -n "$FEATURES" ]; then | |
| echo "### Features" | |
| echo "$FEATURES" | |
| echo "" | |
| fi | |
| if [ -n "$FIXES" ]; then | |
| echo "### Bug Fixes" | |
| echo "$FIXES" | |
| echo "" | |
| fi | |
| if [ -n "$REVERTS" ]; then | |
| echo "### Reverted" | |
| echo "$REVERTS" | |
| echo "" | |
| fi | |
| if [ -n "$OTHER" ]; then | |
| echo "### Other" | |
| echo "$OTHER" | |
| echo "" | |
| fi | |
| echo "### Docker Images" | |
| echo "\`\`\`" | |
| echo "ghcr.io/helmcode/agent_crew:${VERSION#v}" | |
| echo "\`\`\`" | |
| echo "RELEASE_EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Create git tag | |
| run: | | |
| git tag "v${{ needs.preflight.outputs.version }}" | |
| git push origin "v${{ needs.preflight.outputs.version }}" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.preflight.outputs.version }} | |
| name: v${{ needs.preflight.outputs.version }} | |
| body: ${{ steps.notes.outputs.body }} | |
| - name: Notify Slack | |
| if: success() | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_RELEASE_WEBHOOK_URL }} | |
| run: | | |
| VERSION="v${{ needs.preflight.outputs.version }}" | |
| PREV_TAG=$(git tag --sort=-v:refname | grep -v "$VERSION" | head -1) | |
| if [ -z "$PREV_TAG" ]; then | |
| CHANGES=$(git log --oneline --no-merges | head -15) | |
| else | |
| CHANGES=$(git log --oneline --no-merges ${PREV_TAG}..HEAD~1) | |
| fi | |
| # Format changes as bullet list for Slack | |
| BULLET_LIST=$(echo "$CHANGES" | grep -ivE '^[a-f0-9]+ release' | sed 's/^[a-f0-9]* /• /') | |
| RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/${VERSION}" | |
| # Build Slack payload | |
| PAYLOAD=$(cat <<SLACK_EOF | |
| { | |
| "blocks": [ | |
| { | |
| "type": "header", | |
| "text": { | |
| "type": "plain_text", | |
| "text": ":rocket: AgentCrew Frontend ${VERSION} Released" | |
| } | |
| }, | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "*Changes:*\n${BULLET_LIST}" | |
| } | |
| }, | |
| { | |
| "type": "actions", | |
| "elements": [ | |
| { | |
| "type": "button", | |
| "text": { | |
| "type": "plain_text", | |
| "text": ":github: View Release" | |
| }, | |
| "url": "${RELEASE_URL}" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| SLACK_EOF | |
| ) | |
| curl -s -X POST "$SLACK_WEBHOOK_URL" \ | |
| -H 'Content-Type: application/json' \ | |
| -d "$PAYLOAD" |