|
| 1 | +--- |
| 2 | +# Publish semver-tagged Cohere-fork release artifacts to GHCR. |
| 3 | +# |
| 4 | +# Triggered by GitHub Releases targeting the `cohere` branch. The release tag |
| 5 | +# becomes the image/chart tag verbatim, with one normalisation: a leading "v" |
| 6 | +# is stripped for the chart (Helm/OCI requires SemVer with no prefix). |
| 7 | +# |
| 8 | +# Release process: |
| 9 | +# 1. Bump src/cloud-api-adaptor/install/charts/peerpods/Chart.yaml `version` |
| 10 | +# to the new SemVer (e.g. 0.1.4-cohere.2). Merge to cohere. |
| 11 | +# 2. Create a GitHub Release on the cohere branch with tag `v0.1.4-cohere.2` |
| 12 | +# (or `0.1.4-cohere.2` — both work). Publishing the release fires this. |
| 13 | +# |
| 14 | +# Tags produced (release `v0.1.4-cohere.2`): |
| 15 | +# ghcr.io/cohere-ai/cloud-api-adaptor/cloud-api-adaptor:v0.1.4-cohere.2 |
| 16 | +# ghcr.io/cohere-ai/cloud-api-adaptor/peerpod-ctrl:v0.1.4-cohere.2 |
| 17 | +# ghcr.io/cohere-ai/cloud-api-adaptor/charts/peerpods:0.1.4-cohere.2 |
| 18 | +# |
| 19 | +# `latest-cohere` is NOT touched — that floats with the cohere branch tip via |
| 20 | +# publish-cohere.yaml. Consumers pin to the semver tag for stable releases. |
| 21 | +name: Publish (cohere release) |
| 22 | + |
| 23 | +on: |
| 24 | + release: |
| 25 | + types: [published] |
| 26 | + workflow_dispatch: |
| 27 | + inputs: |
| 28 | + tag: |
| 29 | + description: 'Release tag to (re)publish (e.g. v0.1.4-cohere.2). Must already exist as a git tag on cohere.' |
| 30 | + required: true |
| 31 | + type: string |
| 32 | + |
| 33 | +concurrency: |
| 34 | + group: publish-cohere-release-${{ github.event.release.tag_name || inputs.tag }} |
| 35 | + cancel-in-progress: false |
| 36 | + |
| 37 | +permissions: {} |
| 38 | + |
| 39 | +env: |
| 40 | + REGISTRY: ghcr.io/cohere-ai/cloud-api-adaptor |
| 41 | + |
| 42 | +jobs: |
| 43 | + tags: |
| 44 | + name: Compute tags |
| 45 | + runs-on: ubuntu-24.04 |
| 46 | + # Only fire for releases cut from the cohere branch. Manual dispatch always runs. |
| 47 | + if: >- |
| 48 | + github.event_name == 'workflow_dispatch' || |
| 49 | + github.event.release.target_commitish == 'cohere' |
| 50 | + outputs: |
| 51 | + git_ref: ${{ steps.t.outputs.git_ref }} |
| 52 | + image_tag: ${{ steps.t.outputs.image_tag }} |
| 53 | + chart_version: ${{ steps.t.outputs.chart_version }} |
| 54 | + steps: |
| 55 | + - name: Derive tags from release |
| 56 | + id: t |
| 57 | + env: |
| 58 | + RAW_TAG: ${{ github.event.release.tag_name || inputs.tag }} |
| 59 | + run: | |
| 60 | + # Image tags keep the v prefix verbatim; chart strips it (OCI SemVer). |
| 61 | + chart_version="${RAW_TAG#v}" |
| 62 | + echo "git_ref=${RAW_TAG}" >> "$GITHUB_OUTPUT" |
| 63 | + echo "image_tag=${RAW_TAG}" >> "$GITHUB_OUTPUT" |
| 64 | + echo "chart_version=${chart_version}" >> "$GITHUB_OUTPUT" |
| 65 | +
|
| 66 | + caa: |
| 67 | + name: Build CAA image (release, amd64) |
| 68 | + needs: tags |
| 69 | + runs-on: ubuntu-24.04 |
| 70 | + permissions: |
| 71 | + contents: read # checkout the release tag |
| 72 | + packages: write # push image manifests to GHCR |
| 73 | + defaults: |
| 74 | + run: |
| 75 | + working-directory: src/cloud-api-adaptor |
| 76 | + steps: |
| 77 | + - name: Checkout |
| 78 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 79 | + with: |
| 80 | + fetch-depth: 0 |
| 81 | + persist-credentials: false |
| 82 | + ref: ${{ needs.tags.outputs.git_ref }} |
| 83 | + |
| 84 | + - name: Read Go version from versions.yaml |
| 85 | + run: | |
| 86 | + command -v yq || sudo snap install yq |
| 87 | + go_version="$(yq '.tools.golang' versions.yaml)" |
| 88 | + [ -n "$go_version" ] |
| 89 | + echo "GO_VERSION=${go_version}" >> "$GITHUB_ENV" |
| 90 | +
|
| 91 | + - name: Setup Go ${{ env.GO_VERSION }} |
| 92 | + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 |
| 93 | + with: |
| 94 | + go-version: ${{ env.GO_VERSION }} |
| 95 | + cache-dependency-path: "**/go.sum" |
| 96 | + cache: false |
| 97 | + |
| 98 | + - name: Set up Docker Buildx |
| 99 | + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 |
| 100 | + |
| 101 | + - name: Login to GHCR |
| 102 | + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 |
| 103 | + with: |
| 104 | + registry: ghcr.io |
| 105 | + username: ${{ github.repository_owner }} |
| 106 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 107 | + |
| 108 | + - name: Build and push release image |
| 109 | + uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0 |
| 110 | + env: |
| 111 | + REGISTRY: ${{ env.REGISTRY }} |
| 112 | + RELEASE_TAGS: ${{ needs.tags.outputs.image_tag }} |
| 113 | + with: |
| 114 | + timeout_minutes: 60 |
| 115 | + retry_wait_seconds: 120 |
| 116 | + max_attempts: 3 |
| 117 | + command: | |
| 118 | + cd src/cloud-api-adaptor && \ |
| 119 | + ARCHES=linux/amd64 \ |
| 120 | + RELEASE_BUILD=true \ |
| 121 | + RELEASE_TAGS="${RELEASE_TAGS}" \ |
| 122 | + make image registry="${REGISTRY}" |
| 123 | +
|
| 124 | + peerpod-ctrl: |
| 125 | + name: Build peerpod-ctrl image |
| 126 | + needs: tags |
| 127 | + uses: ./.github/workflows/peerpod-ctrl_image.yaml |
| 128 | + with: |
| 129 | + registry: ghcr.io/cohere-ai/cloud-api-adaptor |
| 130 | + git_ref: ${{ needs.tags.outputs.git_ref }} |
| 131 | + image_tags: ${{ needs.tags.outputs.image_tag }} |
| 132 | + permissions: |
| 133 | + contents: read # passed to reusable workflow for checkout |
| 134 | + packages: write # passed to reusable workflow for GHCR push |
| 135 | + secrets: |
| 136 | + # See publish-cohere.yaml for why we pass GITHUB_TOKEN to QUAY_PASSWORD. |
| 137 | + QUAY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} |
| 138 | + |
| 139 | + chart: |
| 140 | + name: Publish peerpods Helm chart |
| 141 | + needs: tags |
| 142 | + uses: ./.github/workflows/peerpods-chart_image.yaml |
| 143 | + with: |
| 144 | + git_ref: ${{ needs.tags.outputs.git_ref }} |
| 145 | + chart_version: ${{ needs.tags.outputs.chart_version }} |
| 146 | + permissions: |
| 147 | + contents: read # checkout the release tag |
| 148 | + packages: write # push chart artifact to GHCR |
| 149 | + id-token: write # OIDC token for actions/attest sigstore signing |
| 150 | + attestations: write # write build provenance attestations |
| 151 | + artifact-metadata: write # actions/attest writes attestation metadata |
0 commit comments