mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-08-22 21:56:21 +00:00
* feat: github actions to publish ecr and docker * test: github actions to publish ecr and docker * chore: yaml lint github actions * chore: yaml lint github actions * fix: secrets envs for github action * chore: build and push action for ecr/docker Co-authored-by: Carol Valencia <krol3@users.noreply.github.com>
66 lines
2.0 KiB
YAML
66 lines
2.0 KiB
YAML
---
|
|
name: Publish
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
env:
|
|
ALIAS: aquasecurity
|
|
REP: kube-hunter
|
|
jobs:
|
|
publish:
|
|
name: Publish
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- name: Check Out Repo
|
|
uses: actions/checkout@v2
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
- name: Cache Docker layers
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildxarch-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-buildxarch-
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USER }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Login to ECR
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: public.ecr.aws
|
|
username: ${{ secrets.ECR_ACCESS_KEY_ID }}
|
|
password: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
|
|
- name: Get version
|
|
id: get_version
|
|
uses: crazy-max/ghaction-docker-meta@v1
|
|
with:
|
|
images: ${{ env.REP }}
|
|
tag-semver: |
|
|
{{version}}
|
|
|
|
- name: Build and push - Docker/ECR
|
|
id: docker_build
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
push: true
|
|
tags: |
|
|
${{ secrets.DOCKERHUB_USER }}/${{ env.REP }}:${{ steps.get_version.outputs.version }}
|
|
public.ecr.aws/${{ env.ALIAS }}/${{ env.REP }}:${{ steps.get_version.outputs.version }}
|
|
${{ secrets.DOCKERHUB_USER }}/${{ env.REP }}:latest
|
|
public.ecr.aws/${{ env.ALIAS }}/${{ env.REP }}:latest
|
|
cache-from: type=local,src=/tmp/.buildx-cache/release
|
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache/release
|
|
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|