Merge pull request #563 from controlplaneio/changelog #7
Workflow file for this run
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: Release Containers | |
on: | |
# https://github.com/actions/runner/issues/1007 | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
release-containers: | |
name: Build and Push container - ${{ matrix.containers.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
containers: | |
- name: kubesec | |
file: ./Dockerfile | |
suffix: "" | |
- name: kubesec scratch | |
file: ./Dockerfile.scratch | |
suffix: -scratch | |
steps: | |
- name: Cache container layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}${{ matrix.containers.suffix }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}${{ matrix.containers.suffix }}-buildx- | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Generate container tags and labels | |
id: docker_meta | |
uses: docker/metadata-action@v5 | |
with: | |
# images: kubesec/kubesec,ghcr.io/controlplaneio/kubesec | |
images: kubesec/kubesec | |
tags: | | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}} | |
flavor: | | |
latest=${{ matrix.containers.suffix == '' }} | |
suffix=${{ matrix.containers.suffix }} | |
labels: | | |
org.opencontainers.image.vendor=controlplane | |
org.opencontainers.image.url=https://kubesec.io/ | |
- name: Login to Docker Hub Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# - name: Login to GitHub Container Registry | |
# uses: docker/login-action@v3 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.repository_owner }} | |
# password: ${{ secrets.CR_PAT }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build container and push tags | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
file: ${{ matrix.containers.file }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: mode=max,type=local,dest=/tmp/.buildx-cache | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} |