char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Daniel Beveniusci : add container image checking and tagging (wip) (#28394)2092353c8

char/aliceai-t5-moe
5.4 KiB152 linesraw
1name: Make Release
2
3on:
4  workflow_dispatch:
5    inputs:
6      commit:
7        description: 'Commit SHA to release (empty = branch HEAD)'
8        required: false
9        default: ''
10        type: string
11      dry_run:
12        description: 'Dry run - validate without creating the tag'
13        required: true
14        type: boolean
15        default: true
16
17env:
18  GH_TOKEN: ${{ github.token }}
19
20permissions:
21  contents: write
22  packages: write
23
24jobs:
25  make-release:
26    runs-on: ubuntu-latest
27
28    steps:
29      - name: Checkout
30        uses: actions/checkout@v6
31        with:
32          ssh-key: ${{ secrets.DEPLOY_KEY_RELEASE }}
33          ref: ${{ inputs.commit != '' && inputs.commit || github.ref_name }}
34          fetch-depth: 0
35
36      - name: Run release checks
37        id: checks
38        run: bash scripts/make-release-checks.sh ${{ github.event.inputs.dry_run == 'true' && '--dry-run' || '' }}
39        env:
40          GITHUB_REPOSITORY: ${{ github.repository }}
41          RELEASE_BRANCH: ${{ github.ref_name }}
42
43      - name: Create release tag
44        if: ${{ github.event.inputs.dry_run == 'false' }}
45        run: |
46          VERSION="${{ steps.checks.outputs.version }}"
47          git config user.name "github-actions[bot]"
48          git config user.email "github-actions[bot]@users.noreply.github.com"
49          git tag -a "${VERSION}" -m "Release ${VERSION}"
50          git push origin "${VERSION}"
51          echo "Created and pushed tag ${VERSION}"
52
53      - name: Generate release description
54        id: desc
55        run: bash scripts/make-release-desc.sh "${{ steps.checks.outputs.version }}"
56        env:
57          GITHUB_REPOSITORY: ${{ github.repository }}
58
59      - name: Create nightly-tag.txt
60        id: nightly_tag_file
61        run: |
62          NIGHTLY_TAG="${{ steps.desc.outputs.nightly_tag }}"
63          if [[ -z "${NIGHTLY_TAG}" ]]; then
64            echo "Warning: no nightly tag found for the release commit - nightly-tag.txt will not be created"
65            echo "create=false" >> "$GITHUB_OUTPUT"
66            exit 0
67          fi
68          echo "${NIGHTLY_TAG}" > nightly-tag.txt
69          echo "create=true" >> "$GITHUB_OUTPUT"
70          echo "nightly-tag.txt:"
71          cat nightly-tag.txt
72
73      - name: Create release
74        id: create_release
75        if: ${{ github.event.inputs.dry_run == 'false' }}
76        uses: ggml-org/action-create-release@v1
77        env:
78          GITHUB_TOKEN: ${{ github.token }}
79        with:
80          tag_name: ${{ steps.checks.outputs.version }}
81          prerelease: false
82          # TODO: enrich the body of the release with more information
83          body: |
84            ## Overview
85
86            New version has been released.
87
88            ## Assets
89
90            ${{ steps.desc.outputs.nightly }}
91
92            ## More info
93
94            - [Releases and versioning of `ggml-org` projects](https://github.com/ggml-org/ggml/discussions/1579)
95
96            ## ${{ steps.desc.outputs.changelog_title }}
97
98            ${{ steps.desc.outputs.changelog }}
99
100      - name: Upload nightly-tag.txt
101        if: ${{ github.event.inputs.dry_run == 'false' && steps.nightly_tag_file.outputs.create == 'true' }}
102        uses: actions/github-script@v8
103        with:
104          github-token: ${{secrets.GITHUB_TOKEN}}
105          script: |
106            const fs = require('fs');
107            const release_id = '${{ steps.create_release.outputs.id }}';
108            console.log('uploadReleaseAsset', 'nightly-tag.txt');
109            await github.rest.repos.uploadReleaseAsset({
110              owner: context.repo.owner,
111              repo: context.repo.repo,
112              release_id: release_id,
113              name: 'nightly-tag.txt',
114              data: await fs.readFileSync('./nightly-tag.txt')
115            });
116
117      - name: Re-tag container images with release version
118        if: ${{ github.event.inputs.dry_run == 'false' && steps.desc.outputs.nightly_tag != '' }}
119        env:
120          GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
121        run: |
122          VERSION="${{ steps.checks.outputs.version }}"
123          NIGHTLY_TAG="${{ steps.desc.outputs.nightly_tag }}"
124          REPO_OWNER="${GITHUB_REPOSITORY_OWNER,,}"
125          IMAGE_REPO="ghcr.io/${REPO_OWNER}/${{ github.event.repository.name }}"
126
127          echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
128
129          VARIANTS=("" "-cuda" "-cuda13" "-vulkan" "-rocm" "-intel" "-musa" "-openvino")
130          TYPES=("full" "light" "server")
131          for type in "${TYPES[@]}"; do
132            for variant in "${VARIANTS[@]}"; do
133              src="${IMAGE_REPO}:${type}${variant}-${NIGHTLY_TAG}"
134              dst="${IMAGE_REPO}:${type}${variant}-${VERSION}"
135              echo "Tagging ${src} -> ${dst}"
136              docker buildx imagetools create --tag "${dst}" "${src}"
137            done
138          done
139
140      - name: Dry run summary
141        if: ${{ github.event.inputs.dry_run == 'true' }}
142        run: |
143          if [[ "${{ steps.checks.outputs.checks_passed }}" == "true" ]]; then
144            echo "Dry run complete - all checks passed."
145            echo "Would have created tag: ${{ steps.checks.outputs.version }}"
146            if [[ -n "${{ steps.desc.outputs.nightly_tag }}" ]]; then
147              echo "Would have uploaded nightly-tag.txt: ${{ steps.desc.outputs.nightly_tag }}"
148            fi
149          else
150            echo "::error::Dry run found release check failures. A release tag would not be created."
151            exit 1
152          fi