chore: update zeam CLI flags from underscores to hyphens #48
Workflow file for this run
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 on Main Branch | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-tags: | |
| # Only run if PR was merged to main from release branch and has release label | |
| if: | | |
| github.event.pull_request.merged == true && | |
| github.event.pull_request.head.ref == 'release' && | |
| contains(github.event.pull_request.labels.*.name, 'release') | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.get_tags_labels.outputs.version }} | |
| devnet_tag: ${{ steps.get_tags_labels.outputs.devnet_tag }} | |
| docker_tag: ${{ steps.get_tags_labels.outputs.docker_tag }} | |
| github_tag: ${{ steps.get_tags_labels.outputs.github_tag }} | |
| has_devnet_tag: ${{ steps.get_tags_labels.outputs.has_devnet_tag }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract tags from PR labels | |
| id: get_tags_labels | |
| run: | | |
| LABELS='${{ toJson(github.event.pull_request.labels.*.name) }}' | |
| echo "PR Labels: $LABELS" | |
| VERSION=$(echo $LABELS | jq -r '.[] | select(test("^[0-9]+\\.[0-9]+\\.[0-9]+$"))' | head -n 1) | |
| DEVNET_TAG_LOWER=$(echo $LABELS | jq -r '.[] | select(test("^devnet[0-9]+$"))' | head -n 1) | |
| if [ -z "$VERSION" ] || [ "$VERSION" = "null" ]; then | |
| echo "❌ Version label is mandatory! Please add a version label in x.y.z format (e.g. 1.0.0)" | |
| exit 1 | |
| else | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "git_tag=v$VERSION" >> $GITHUB_OUTPUT | |
| echo "✅ Version found: $VERSION" | |
| fi | |
| if [ -n "$DEVNET_TAG_LOWER" ] && [ "$DEVNET_TAG_LOWER" != "null" ]; then | |
| DOCKER_TAG="$DEVNET_TAG_LOWER" | |
| GITHUB_TAG="D${DEVNET_TAG_LOWER:1}" | |
| echo "devnet_tag=$DOCKER_TAG" >> $GITHUB_OUTPUT | |
| echo "docker_tag=$DOCKER_TAG" >> $GITHUB_OUTPUT | |
| echo "github_tag=$GITHUB_TAG" >> $GITHUB_OUTPUT | |
| echo "has_devnet_tag=true" >> $GITHUB_OUTPUT | |
| echo "✅ Found devnet tag: label=$DEVNET_TAG_LOWER -> docker_tag=$DOCKER_TAG, github_tag=$GITHUB_TAG" | |
| else | |
| echo "has_devnet_tag=false" >> $GITHUB_OUTPUT | |
| echo "ℹ️ No devnet tag found (optional)" | |
| fi | |
| - name: Create and push git tags | |
| id: create_tags | |
| run: | | |
| git fetch --prune --tags --force | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| CREATE_VERSION_TAG=false | |
| CREATE_DEVNET_TAG=false | |
| if [ -n "${{ steps.get_tags_labels.outputs.version }}" ] && [ "${{ steps.get_tags_labels.outputs.version }}" != "null" ]; then | |
| if git rev-parse "${{ steps.get_tags_labels.outputs.git_tag }}" >/dev/null 2>&1; then | |
| echo "❌ Version tag ${{ steps.get_tags_labels.outputs.git_tag }} already exists. Please use a different version label." | |
| exit 1 | |
| else | |
| CREATE_VERSION_TAG=true | |
| fi | |
| fi | |
| if [ "${{ steps.get_tags_labels.outputs.has_devnet_tag }}" = "true" ]; then | |
| DEVNET_GIT_TAG="${{ steps.get_tags_labels.outputs.github_tag }}" | |
| if git rev-parse "$DEVNET_GIT_TAG" >/dev/null 2>&1; then | |
| echo "🗑️ Devnet tag $DEVNET_GIT_TAG already exists, will be recreated" | |
| git tag -d "$DEVNET_GIT_TAG" || echo "⚠️ Local tag deletion failed" | |
| git push --delete origin "$DEVNET_GIT_TAG" || echo "⚠️ Remote tag deletion failed" | |
| fi | |
| CREATE_DEVNET_TAG=true | |
| fi | |
| if [ "$CREATE_VERSION_TAG" = "true" ]; then | |
| git tag -a "${{ steps.get_tags_labels.outputs.git_tag }}" -m "Release version ${{ steps.get_tags_labels.outputs.version }}" | |
| git push origin "${{ steps.get_tags_labels.outputs.git_tag }}" | |
| echo "✅ Created version tag ${{ steps.get_tags_labels.outputs.git_tag }}" | |
| fi | |
| if [ "$CREATE_DEVNET_TAG" = "true" ]; then | |
| git tag -a "$DEVNET_GIT_TAG" -m "Devnet release for $DEVNET_GIT_TAG" | |
| git push origin "$DEVNET_GIT_TAG" | |
| echo "✅ Created devnet git tag $DEVNET_GIT_TAG" | |
| fi | |
| echo "create_version_tag=$CREATE_VERSION_TAG" >> $GITHUB_OUTPUT | |
| echo "create_devnet_tag=$CREATE_DEVNET_TAG" >> $GITHUB_OUTPUT | |
| create-github-release: | |
| needs: [create-tags] | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.create-tags.outputs.has_devnet_tag == 'true' }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Delete existing devnet release if exists | |
| run: | | |
| DEVNET_TAG="${{ needs.create-tags.outputs.github_tag }}" | |
| echo "🔍 Checking for existing $DEVNET_TAG release..." | |
| if gh api repos/${{ github.repository }}/releases/tags/$DEVNET_TAG >/dev/null 2>&1; then | |
| RELEASE_ID=$(gh api repos/${{ github.repository }}/releases/tags/$DEVNET_TAG --jq '.id') | |
| echo "🗑️ Found existing GitHub release for $DEVNET_TAG (ID: $RELEASE_ID), deleting..." | |
| gh api --method DELETE repos/${{ github.repository }}/releases/$RELEASE_ID | |
| echo "✅ Deleted existing GitHub release" | |
| else | |
| echo "ℹ️ No existing GitHub release found for $DEVNET_TAG" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate changelog from previous release | |
| id: changelog | |
| run: | | |
| DEVNET_TAG="${{ needs.create-tags.outputs.github_tag }}" | |
| PREVIOUS_TAG=$(git tag -l | grep -iE "^[Dd]evnet[0-9]+" | sort -V -r | grep -v "^$DEVNET_TAG$" | head -1) | |
| if [ -n "$PREVIOUS_TAG" ] && [ "$PREVIOUS_TAG" != "$DEVNET_TAG" ]; then | |
| echo "✅ Found previous tag: $PREVIOUS_TAG" | |
| echo "📝 Generating changelog from $PREVIOUS_TAG to current release..." | |
| COMMIT_LOG=$(git log --pretty=format:"- %s (%h)" --no-merges "$PREVIOUS_TAG"..HEAD) | |
| FILES_CHANGED=$(git diff --name-only "$PREVIOUS_TAG"..HEAD | wc -l) | |
| INSERTIONS=$(git diff --shortstat "$PREVIOUS_TAG"..HEAD | grep -o '[0-9]\+ insertion' | grep -o '[0-9]\+' || echo "0") | |
| DELETIONS=$(git diff --shortstat "$PREVIOUS_TAG"..HEAD | grep -o '[0-9]\+ deletion' | grep -o '[0-9]\+' || echo "0") | |
| CONTRIBUTORS=$(git log --pretty=format:"%an" --no-merges "$PREVIOUS_TAG"..HEAD | sort | uniq | tr '\n' ', ' | sed 's/, $//') | |
| CHANGELOG="## 📋 Changes since $PREVIOUS_TAG | |
| ### 📊 Summary | |
| - **Files changed**: $FILES_CHANGED | |
| - **Insertions**: +$INSERTIONS | |
| - **Deletions**: -$DELETIONS | |
| - **Contributors**: $CONTRIBUTORS | |
| ### 🔄 Recent commits | |
| $COMMIT_LOG | |
| ### 🔗 Compare changes | |
| [View full diff](${{ github.server_url }}/${{ github.repository }}/compare/$PREVIOUS_TAG...HEAD)" | |
| else | |
| echo "ℹ️ No previous release found or this is the first release" | |
| CHANGELOG="## 📋 Changes | |
| This is the first devnet release for lean-quickstart." | |
| fi | |
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.create-tags.outputs.github_tag }} | |
| name: "lean-quickstart ${{ needs.create-tags.outputs.github_tag }} Release" | |
| body: | | |
| # lean-quickstart ${{ needs.create-tags.outputs.github_tag }} Release | |
| ## Release information | |
| - **Version**: ${{ needs.create-tags.outputs.version }} | |
| - **Network tag**: ${{ needs.create-tags.outputs.github_tag }} | |
| - **Branch**: `${{ needs.create-tags.outputs.docker_tag }}` (updated from `main` after merge) | |
| This repository provides devnet tooling (Ansible, scripts, genesis helpers). Client container images are published from the [zeam](https://github.com/blockblaz/zeam) repository. | |
| ## 📋 Changes | |
| ${{ steps.changelog.outputs.changelog }} | |
| ## 🌿 Use this release | |
| ```bash | |
| git fetch origin tag ${{ needs.create-tags.outputs.github_tag }} | |
| git checkout ${{ needs.create-tags.outputs.github_tag }} | |
| ``` | |
| draft: false | |
| prerelease: true | |
| - name: Push code to corresponding devnet branch | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| GITHUB_TAG="${{ needs.create-tags.outputs.github_tag }}" | |
| DOCKER_TAG="${{ needs.create-tags.outputs.docker_tag }}" | |
| DEVNET_BRANCH="$DOCKER_TAG" | |
| git fetch origin main | |
| echo "✅ GitHub tag: $GITHUB_TAG, branch: $DEVNET_BRANCH" | |
| if git ls-remote --heads origin "$DEVNET_BRANCH" | grep -q "$DEVNET_BRANCH"; then | |
| echo "✅ $DEVNET_BRANCH branch exists, updating it" | |
| git fetch origin "$DEVNET_BRANCH" | |
| git checkout "$DEVNET_BRANCH" | |
| git merge origin/main --no-edit | |
| else | |
| echo "✅ $DEVNET_BRANCH branch doesn't exist, creating it from current main" | |
| git checkout -b "$DEVNET_BRANCH" | |
| fi | |
| git push origin "$DEVNET_BRANCH" | |
| echo "✅ Successfully pushed code to $DEVNET_BRANCH branch" | |
| - name: Send Telegram success notification | |
| if: ${{ success() }} | |
| env: | |
| TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
| run: | | |
| if [ -z "$TELEGRAM_BOT_TOKEN" ] || [ -z "$TELEGRAM_CHAT_ID" ]; then | |
| echo "ℹ️ Telegram secrets not set; skipping notification" | |
| exit 0 | |
| fi | |
| DOCKER_TAG="${{ needs.create-tags.outputs.docker_tag }}" | |
| GITHUB_TAG="${{ needs.create-tags.outputs.github_tag }}" | |
| VERSION="${{ needs.create-tags.outputs.version }}" | |
| REPO_URL="${{ github.server_url }}/${{ github.repository }}" | |
| MESSAGE="🚀 *lean-quickstart $GITHUB_TAG release SUCCESS* | |
| *Release details:* | |
| • Version: \`$VERSION\` | |
| • Network: \`$GITHUB_TAG\` | |
| • Repository: [${{ github.repository }}]($REPO_URL) | |
| *🔗 Links:* | |
| • [GitHub release]($REPO_URL/releases/tag/$GITHUB_TAG) | |
| *🌿 Branch:* | |
| • Code pushed to \`$DOCKER_TAG\` | |
| _Automated release notification_" | |
| curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{ | |
| \"chat_id\": \"${TELEGRAM_CHAT_ID}\", | |
| \"text\": \"$MESSAGE\", | |
| \"parse_mode\": \"Markdown\", | |
| \"disable_web_page_preview\": true | |
| }" && echo "📱 Telegram notification sent successfully" || echo "❌ Failed to send Telegram notification" |