-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #237 from controlplaneio/fix_container_builds
- Loading branch information
Showing
7 changed files
with
98 additions
and
172 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
--- | ||
name: Release | ||
on: | ||
create: | ||
# https://github.com/actions/runner/issues/1007 | ||
push: | ||
tags: | ||
- v*.*.* | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
release: | ||
|
@@ -13,7 +15,7 @@ jobs: | |
uses: actions/[email protected] | ||
id: go | ||
with: | ||
go-version: ^1.15 | ||
go-version: ^1.17 | ||
|
||
- name: Check out code | ||
uses: actions/[email protected] | ||
|
@@ -24,65 +26,3 @@ jobs: | |
args: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
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/[email protected] | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}${{ matrix.containers.suffix }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}${{ matrix.containers.suffix }}-buildx- | ||
- name: Generate container tags and labels | ||
id: docker_meta | ||
uses: crazy-max/[email protected] | ||
with: | ||
# images: kubesec/kubesec,ghcr.io/controlplaneio/kubesec | ||
images: kubesec/kubesec | ||
tag-latest: ${{ matrix.containers.suffix == '' }} | ||
tag-semver: | | ||
{{version}}${{ matrix.containers.suffix }} | ||
label-custom: | | ||
org.opencontainers.image.vendor=controlplane | ||
org.opencontainers.image.url=https://kubesec.io/ | ||
- name: Login to Docker Hub Registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: docker.io | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
# - name: Login to GitHub Container Registry | ||
# uses: docker/[email protected] | ||
# with: | ||
# registry: ghcr.io | ||
# username: ${{ github.repository_owner }} | ||
# password: ${{ secrets.CR_PAT }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
||
- name: Build container and push tags | ||
uses: docker/[email protected] | ||
with: | ||
push: true | ||
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 }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
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/[email protected] | ||
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/[email protected] | ||
|
||
- name: Generate container tags and labels | ||
id: docker_meta | ||
uses: docker/[email protected] | ||
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/[email protected] | ||
with: | ||
registry: docker.io | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
# - name: Login to GitHub Container Registry | ||
# uses: docker/[email protected] | ||
# with: | ||
# registry: ghcr.io | ||
# username: ${{ github.repository_owner }} | ||
# password: ${{ secrets.CR_PAT }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
||
- name: Build container and push tags | ||
uses: docker/[email protected] | ||
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 }} |
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
This file was deleted.
Oops, something went wrong.
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
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