Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
ci: migrate to gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sameersbn committed Mar 27, 2023
1 parent d891558 commit 5c0c4fe
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 112 deletions.
70 changes: 0 additions & 70 deletions .circleci/config.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Dependabot configuration
#
# For more information, please refer to:
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates

version: 2

updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
86 changes: 86 additions & 0 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build and Release

on:
workflow_dispatch:
branches:
- main
push:
branches:
- main
tags:
- 'v*'
pull_request:

jobs:
publish-images:
name: Build and publish image
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- runtime: java8
- runtime: node10
- runtime: node4
- runtime: python27
- runtime: python37
- runtime: ruby25

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Login to GCR
uses: docker/login-action@v2
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCLOUD_SERVICEACCOUNT_KEY }}
if: github.event_name != 'pull_request'

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: gcr.io/triggermesh/knative-lambda-${{ matrix.runtime }}
tags: |
type=semver,pattern={{raw}}
type=sha,prefix=,suffix=,format=long
- name: Build and push image
uses: docker/build-push-action@v4
with:
provenance: false
context: ${{ matrix.runtime }}
file: ${{ matrix.runtime }}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

create-release:
name: Create Release
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: publish-images
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Preparing Release Notes
run: |
./scripts/release-notes.sh ${GITHUB_REF_NAME} > release-notes.md
- name: Creating Release
uses: ncipollo/release-action@v1
with:
bodyFile: "release-notes.md"
17 changes: 3 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ BASE_DIR ?= $(CURDIR)

DOCKER ?= docker
IMAGE_REPO ?= gcr.io/triggermesh
IMAGE_TAG ?= latest
IMAGE_SHA ?= $(shell git rev-parse HEAD)
IMAGE_TAG ?= $(shell git rev-parse HEAD)

.PHONY: help images cloudbuild-test cloudbuild
.PHONY: help images

all: images

Expand All @@ -19,14 +18,4 @@ help: ## Display this help
IMAGES = $(foreach r,$(RUNTIMES),$(r).image)
images: $(IMAGES) ## Build the Docker images
$(IMAGES): %.image:
docker build -t $(IMAGE_REPO)/knative-lambda-$* $*

CLOUDBUILD_TEST = $(foreach r,$(RUNTIMES),$(r).cloudbuild-test)
cloudbuild-test: $(CLOUDBUILD_TEST) ## Test container image build with Google Cloud Build
$(CLOUDBUILD_TEST): %.cloudbuild-test:
gcloud builds submit $* --config cloudbuild.yaml --substitutions _RUNTIME=knative-lambda-$*,COMMIT_SHA=${IMAGE_SHA},_KANIKO_USE_BUILD_CACHE=false,_KANIKO_IMAGE_TAG=_

CLOUDBUILD = $(foreach r,$(RUNTIMES),$(r).cloudbuild)
cloudbuild: $(CLOUDBUILD) ## Build and publish image to GCR
$(CLOUDBUILD): %.cloudbuild:
gcloud builds submit $* --config cloudbuild.yaml --substitutions _RUNTIME=knative-lambda-$*,COMMIT_SHA=${IMAGE_SHA},_KANIKO_USE_BUILD_CACHE=false,_KANIKO_IMAGE_TAG=${IMAGE_TAG}
docker build -t $(IMAGE_REPO)/knative-lambda-$*:${IMAGE_TAG} $*
28 changes: 0 additions & 28 deletions cloudbuild.yaml

This file was deleted.

0 comments on commit 5c0c4fe

Please sign in to comment.