Skip to content

Commit

Permalink
Add build action
Browse files Browse the repository at this point in the history
  • Loading branch information
clementblaise committed Aug 19, 2021
1 parent 30bb3c8 commit a2bfca6
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 26 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: build

on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'

jobs:
release:
name: Create Build
runs-on: ubuntu-latest
strategy:
matrix:
component: [webhook, api, operator]
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: cagip/kubi-${{ matrix.component }}
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.${{ matrix.component }}
push: ${{ GitHub.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
37 changes: 11 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,29 @@ name: release

on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'
- "*"

jobs:
release:
name: Create Release
runs-on: ubuntu-latest
strategy:
matrix:
component: [webhook, api, operator]
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: cagip/kubi-${{ matrix.component }}
fetch-depth: 0
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
name: Set up Go
uses: actions/setup-go@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
go-version: 1.15
-
name: Build and push
uses: docker/build-push-action@v2
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
context: .
file: Dockerfile.${{ matrix.component }}
push: ${{ GitHub.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit a2bfca6

Please sign in to comment.