CD #11
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
| # Code generated by ADL CLI v0.23.2. DO NOT EDIT. | |
| # This file was automatically generated from an ADL (Agent Definition Language) specification. | |
| # Manual changes to this file may be overwritten during regeneration. | |
| --- | |
| name: CD | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| packages: write | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| new_release_version: ${{ steps.semantic.outputs.new_release_version }} | |
| new_release_published: ${{ steps.semantic.outputs.new_release_published }} | |
| steps: | |
| - uses: actions/[email protected] | |
| id: app-token | |
| with: | |
| app-id: ${{ secrets.BOT_GH_APP_ID }} | |
| private-key: ${{ secrets.BOT_GH_APP_PRIVATE_KEY }} | |
| owner: ${{ github.repository_owner }} | |
| repositories: | | |
| ${{ github.event.repository.name }} | |
| - name: Get GitHub App User ID | |
| id: get-user-id | |
| run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| - name: Set up Git | |
| run: | | |
| git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' | |
| git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com' | |
| git config --global commit.gpgsign false | |
| git config --global commit.signoff true | |
| - name: Checkout code | |
| uses: actions/[email protected] | |
| with: | |
| ref: ${{ github.ref }} | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Set up Go | |
| uses: actions/[email protected] | |
| with: | |
| go-version: 1.25 | |
| cache: true | |
| - name: Install Task | |
| uses: arduino/setup-task@v2 | |
| with: | |
| version: 3.x | |
| - name: Install ADL CLI | |
| run: | | |
| curl -fsSL https://raw.githubusercontent.com/inference-gateway/adl-cli/main/install.sh | bash | |
| adl --version | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run tests | |
| run: task test | |
| - name: Build | |
| run: task build | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| version: latest | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Node.js for semantic-release | |
| uses: actions/[email protected] | |
| with: | |
| node-version: 22 | |
| - name: Install semantic-release and plugins | |
| run: | | |
| npm install -g [email protected] \ | |
| conventional-changelog-cli \ | |
| conventional-changelog-conventionalcommits \ | |
| @semantic-release/changelog \ | |
| @semantic-release/git \ | |
| @semantic-release/github \ | |
| @semantic-release/exec | |
| - name: Create a release if needed | |
| id: semantic | |
| env: | |
| CI: true | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| run: | | |
| # Create first release if not exists - Initial Release Version 0.1.0 | |
| if ! gh release view v0.1.0 >/dev/null 2>&1; then | |
| gh release create v0.1.0 --title "Initial Release" --notes "Initial Release" --target main | |
| fi | |
| # Run semantic-release in dry-run first to capture version | |
| DRY_OUTPUT=$(semantic-release --dry-run 2>&1 || true) | |
| # Check if there are no changes | |
| if $(echo "$DRY_OUTPUT" | grep -q "no new version is released"); then | |
| echo "No new release needed" | |
| echo "new_release_published=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| # Extract version from dry run output | |
| VERSION=$(echo "$DRY_OUTPUT" | grep -o "The next release version is [0-9]\+\.[0-9]\+\.[0-9]\+\(-rc\.[0-9]\+\)\?" | cut -d ' ' -f6) | |
| if [ -z "$VERSION" ]; then | |
| echo "Error: Could not determine version" | |
| echo "Output: $DRY_OUTPUT" | |
| exit 1 | |
| fi | |
| echo "new_release_version=$VERSION" >> $GITHUB_OUTPUT | |
| # Run actual release | |
| if semantic-release; then | |
| echo "Successfully released version $VERSION" | |
| echo "new_release_published=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Release failed" | |
| exit 1 | |
| fi |