diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..28e56b55 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e5aa1b4..ec03a1df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} \ No newline at end of file + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file