|
20 | 20 | # - CONTAINERFILE_NAME is name and location of the Containerfile.
|
21 | 21 | env:
|
22 | 22 | KANIKO_BUILD_CONTEXT: "${{ github.workspace }}"
|
23 |
| - CONTAINERFILE_NAME: "${{ github.workspace }}/Containerfile.goreleaser-ko-cosign-trivy-syft-x86-arm64-root-usr" |
| 23 | + CONTAINERFILE_NAME: "${{ github.workspace }}/Containerfile.goreleaser-ko-cosign-trivy-syft-x86-arm64-root-usr.base" |
24 | 24 |
|
25 | 25 | jobs:
|
26 | 26 | build:
|
27 | 27 | runs-on: ubuntu-latest
|
28 | 28 | steps:
|
29 |
| - - uses: actions/checkout@v4 |
30 |
| - - uses: docker/metadata-action@v5 |
| 29 | + - name: Checkout source code |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Extract Versions from Containerfile |
| 33 | + id: extract |
| 34 | + run: | |
| 35 | + # Extract values from the Containerfile |
| 36 | + GOLANG_VERSION=$(grep -m1 'ARG GOLANG_VERSION=' $CONTAINERFILE_NAME | cut -d'=' -f2) |
| 37 | + echo "GOLANG_VERSION=${GOLANG_VERSION}" >> $GITHUB_ENV |
| 38 | + GORELEASER_VERSION=$(grep -m1 'ARG GORELEASER_VERSION=' $CONTAINERFILE_NAME | cut -d'=' -f2) |
| 39 | + echo "GORELEASER_VERSION=${GORELEASER_VERSION}" >> $GITHUB_ENV |
| 40 | + env: |
| 41 | + golang_version: ${{ env.GOLANG_VERSION }} |
| 42 | + goreleaser_version: ${{ env.GORELEASER_VERSION }} |
| 43 | + |
| 44 | + - name: Container metadata and tags |
| 45 | + uses: docker/metadata-action@v5 |
31 | 46 | id: metadata
|
32 | 47 | with:
|
33 |
| - images: ghcr.io/${{ github.repository }} |
| 48 | + images: ghcr.io/${{ github.repository }}-base |
| 49 | + tags: | |
| 50 | + type=ref,event=branch |
| 51 | + type=raw,value=golang-${{ steps.extract.outputs.golang_version }} |
| 52 | + type=raw,value=goreleaser-${{ steps.extract.outputs.goreleaser_version }} |
| 53 | + # minimal (short sha) |
| 54 | + type=sha |
| 55 | + # full length sha |
| 56 | + type=sha,format=long |
| 57 | +
|
34 | 58 | - uses: docker/login-action@v3
|
35 | 59 | with:
|
36 | 60 | registry: ghcr.io
|
37 | 61 | username: ${{ github.actor }}
|
38 | 62 | password: ${{ secrets.GITHUB_TOKEN }}
|
| 63 | + |
39 | 64 | - uses: int128/kaniko-action@v1
|
40 | 65 | with:
|
41 | 66 | push: true
|
|
0 commit comments