nightly #1130
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: nightly | |
on: | |
schedule: | |
- cron: '30 3 * * *' | |
workflow_dispatch: {} | |
permissions: | |
contents: read | |
jobs: | |
build-push-images: | |
timeout-minutes: ${{ fromJSON(vars.GHA_EXTENDED_TIMEOUT_MINUTES) }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
# Setup Golang to use go pkg cache which is utilized in Dockerfile's cache mount. | |
- name: Setup golang | |
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version-file: go.mod | |
- run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
- run: echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV | |
- name: Add standard tags | |
id: tags-standard | |
run: | | |
( | |
echo 'TAGS_STANDARD<<EOF' | |
echo 'type=raw,value=nightly' | |
echo "type=raw,value={{date 'YYYY-MM-DD'}}" | |
echo 'EOF' | |
) >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 | |
- name: Cache Docker layers | |
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to DockerHub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1 | |
with: | |
images: kong/nightly-ingress-controller | |
tags: ${{ steps.tags-standard.outputs.TAGS_STANDARD }} | |
- name: Build binary | |
id: docker_build_binary | |
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0 | |
with: | |
push: false | |
file: Dockerfile | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
target: builder | |
platforms: linux/amd64, linux/arm64 | |
build-args: | | |
TAG=${{ steps.meta.outputs.version }} | |
COMMIT=${{ github.sha }} | |
REPO_INFO=https://github.com/${{ github.repository }}.git | |
GOPATH=${{ env.GOPATH}} | |
GOCACHE=${{ env.GOCACHE}} | |
- name: Build and push distroless image to DockerHub | |
id: docker_build | |
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0 | |
with: | |
push: true | |
file: Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
target: distroless | |
platforms: linux/amd64, linux/arm64 | |
build-args: | | |
TAG=${{ steps.meta.outputs.version }} | |
COMMIT=${{ github.sha }} | |
REPO_INFO=https://github.com/${{ github.repository }}.git | |
GOPATH=${{ env.GOPATH}} | |
GOCACHE=${{ env.GOCACHE}} |