|
| 1 | +name: container-build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ['*'] |
| 6 | + |
| 7 | +env: |
| 8 | + KO_DEFAULTPLATFORMS: all |
| 9 | + |
| 10 | +jobs: |
| 11 | + release-container: |
| 12 | + name: Build the release container images |
| 13 | + runs-on: ubuntu-latest |
| 14 | + permissions: |
| 15 | + packages: write |
| 16 | + steps: |
| 17 | + - name: Check out the repo |
| 18 | + uses: actions/checkout@v4 |
| 19 | + - id: lowercase-repository-name |
| 20 | + uses: ASzc/change-string-case-action@v6 |
| 21 | + with: |
| 22 | + string: ${{ github.repository }} |
| 23 | + - name: Get tag name |
| 24 | + id: tag_name |
| 25 | + run: | |
| 26 | + echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT |
| 27 | + - name: Setup Go |
| 28 | + uses: actions/setup-go@v5 |
| 29 | + with: |
| 30 | + go-version: 1.21 |
| 31 | + check-latest: true |
| 32 | + - name: Setup Ko |
| 33 | + |
| 34 | + - name: Build the crane-ish builder images |
| 35 | + run: | |
| 36 | + ko build -B github.com/google/go-containerregistry/cmd/crane -t latest -t $GITHUB_SHA -t $SOURCE_TAG |
| 37 | + ko build -B github.com/google/go-containerregistry/cmd/gcrane -t latest -t $GITHUB_SHA -t $SOURCE_TAG |
| 38 | + # ./cmd/krane is a separate module, so switch directories. |
| 39 | + cd ./cmd/krane |
| 40 | + ko build -B github.com/google/go-containerregistry/cmd/krane -t latest -t $GITHUB_SHA -t $SOURCE_TAG |
| 41 | + env: |
| 42 | + KO_DOCKER_REPO: ghcr.io/${{ steps.lowercase-repository-name.outputs.lowercase }} |
| 43 | + SOURCE_TAG: ${{ steps.tag_name.outputs.SOURCE_TAG }} |
| 44 | + GOFLAGS: -ldflags=-X=github.com/google/go-containerregistry/cmd/crane/cmd.Version=${{ steps.tag_name.outputs.SOURCE_TAG }} |
| 45 | + - name: Build the crane-ish builder debug images |
| 46 | + run: | |
| 47 | + ko build -B github.com/google/go-containerregistry/cmd/crane -t "debug" |
| 48 | + ko build -B github.com/google/go-containerregistry/cmd/gcrane -t "debug" |
| 49 | + # ./cmd/krane is a separate module, so switch directories. |
| 50 | + cd ${{ github.workspace }}/cmd/krane |
| 51 | + ko build -B github.com/google/go-containerregistry/cmd/krane -t "debug" |
| 52 | + env: |
| 53 | + KO_CONFIG_PATH: ${{ github.workspace }}/.ko/debug/.ko.yaml |
| 54 | + GOFLAGS: -ldflags=-X=github.com/google/go-containerregistry/cmd/crane/cmd.Version=${{ steps.tag_name.outputs.SOURCE_TAG }} |
| 55 | + - name: Build the tag specific debug images |
| 56 | + run: | |
| 57 | + KO_DOCKER_REPO=ghcr.io/${{ steps.lowercase-repository-name.outputs.lowercase }}/crane/debug ko build --bare github.com/google/go-containerregistry/cmd/crane -t latest -t $GITHUB_SHA -t $SOURCE_TAG |
| 58 | + KO_DOCKER_REPO=ghcr.io/${{ steps.lowercase-repository-name.outputs.lowercase }}/gcrane/debug ko build --bare github.com/google/go-containerregistry/cmd/gcrane -t latest -t $GITHUB_SHA -t $SOURCE_TAG |
| 59 | + # ./cmd/krane is a separate module, so switch directories. |
| 60 | + cd ./cmd/krane |
| 61 | + KO_DOCKER_REPO=ghcr.io/${{ steps.lowercase-repository-name.outputs.lowercase }}/krane/debug ko build --bare github.com/google/go-containerregistry/cmd/krane -t latest -t $GITHUB_SHA -t $SOURCE_TAG |
| 62 | + env: |
| 63 | + KO_CONFIG_PATH: ${{ github.workspace }}/.ko/debug/.ko.yaml |
| 64 | + SOURCE_TAG: ${{ steps.tag_name.outputs.SOURCE_TAG }} |
| 65 | + GOFLAGS: -ldflags=-X=github.com/google/go-containerregistry/cmd/crane/cmd.Version=${{ steps.tag_name.outputs.SOURCE_TAG }} |
0 commit comments