|
13 | 13 | # See the License for the specific language governing permissions and |
14 | 14 | # limitations under the License. |
15 | 15 |
|
16 | | -name: Run the CD script after tags that look like versions |
| 16 | +name: Build and push tagged image |
| 17 | + |
17 | 18 | on: |
18 | 19 | push: |
19 | 20 | tags: |
20 | | - - "**/v[0-9]+.*" |
| 21 | + - "functions/*/*/v*" |
| 22 | + - "contrib/functions/*/*/v*" |
21 | 23 |
|
22 | 24 | jobs: |
23 | | - build: |
24 | | - name: after-tag-with-version |
| 25 | + build-push-release: |
25 | 26 | runs-on: ubuntu-latest |
26 | 27 | permissions: |
27 | 28 | packages: write |
| 29 | + contents: read |
28 | 30 | steps: |
29 | | - - uses: actions/checkout@v4 |
30 | | - - uses: actions/setup-go@v5 |
31 | | - with: |
32 | | - go-version: '1.24.3' |
33 | | - - run: go version |
34 | | - - name: dev/cd/after-tag-push |
35 | | - run: GIT_REF=${GITHUB_REF} IMAGE_REPO=ghcr.io/${{ github.repository }} dev/cd/after-tag-with-version |
36 | | - env: |
37 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Setup Go |
| 35 | + uses: actions/setup-go@v5 |
| 36 | + with: |
| 37 | + go-version: '1.24.3' |
| 38 | + |
| 39 | + - name: Setup QEMU |
| 40 | + uses: docker/setup-qemu-action@v3 |
| 41 | + |
| 42 | + - name: Setup Buildx |
| 43 | + uses: docker/setup-buildx-action@v3 |
| 44 | + |
| 45 | + - name: Log in to GHCR |
| 46 | + run: | |
| 47 | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin |
| 48 | +
|
| 49 | + - name: Extract semver and image name |
| 50 | + id: extract |
| 51 | + uses: ./.github/actions/extract-tag-info |
| 52 | + |
| 53 | + - name: Show outputs |
| 54 | + run: | |
| 55 | + echo "Version = ${{ steps.extract.outputs.version }}" |
| 56 | + echo "Image name = ${{ steps.extract.outputs.image_name }}" |
| 57 | +
|
| 58 | + - name: Determine release type and push image |
| 59 | + run: | |
| 60 | + VERSION="${{ steps.extract.outputs.version }}" |
| 61 | + IMAGE_NAME="${{ steps.extract.outputs.image_name }}" |
| 62 | +
|
| 63 | + if [[ "${GITHUB_REF#refs/tags/}" == functions/* ]]; then |
| 64 | + echo "Detected curated functions release" |
| 65 | + cd functions/go |
| 66 | + make func-push TAG=$VERSION CURRENT_FUNCTION=$IMAGE_NAME DEFAULT_CR=ghcr.io/${GITHUB_REPOSITORY} |
| 67 | + elif [[ "${GITHUB_REF#refs/tags/}" == contrib/functions/* ]]; then |
| 68 | + echo "Detected contrib functions release" |
| 69 | + cd contrib/functions/go |
| 70 | + make func-push TAG=$VERSION CURRENT_FUNCTION=$IMAGE_NAME DEFAULT_CR=ghcr.io/${GITHUB_REPOSITORY}/krm-fn-contrib |
| 71 | + else |
| 72 | + echo "Tag does not match any known type, skipping." |
| 73 | + exit 0 |
| 74 | + fi |
0 commit comments