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

Bump actions/checkout from 3 to 4 #23

Bump actions/checkout from 3 to 4

Bump actions/checkout from 3 to 4 #23

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: node4
- runtime: node10
- runtime: node18
- runtime: python27
- runtime: python37
- runtime: python310
- runtime: ruby25
- runtime: ruby32
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}
update-manifests:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
name: Update TriggerMesh Manifests
runs-on: ubuntu-latest
needs: publish-images
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout triggermesh/triggermesh
uses: actions/checkout@v4
with:
path: 'tm-triggermesh'
ref: 'main'
repository: 'triggermesh/triggermesh'
token: ${{ secrets.TM_TRIGGERMESH_TOKEN }}
- name: Prepare updates
working-directory: tm-triggermesh
run: |
RUNTIMES=$(sed -n -e "s/^\(RUNTIMES[[:space:]]*=[[:space:]]*\)\(.*\)$/\2/p" ../Makefile)
echo $RUNTIMES
for runtime in ${RUNTIMES}; do
sed -i config/500-controller.yaml -e "s|gcr.io/triggermesh/knative-lambda-${runtime##*/}:.*|gcr.io/triggermesh/knative-lambda-${runtime##*/}:"${GITHUB_REF_NAME}"|g"
done
git --no-pager diff
- name: Commit and push changes
working-directory: tm-triggermesh
run: |
git add -A
git status --porcelain
if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
git config --global user.name 'TriggerMesh Bot'
git config --global user.email '[email protected]'
git commit -m "Update function runtime to release '${GITHUB_REF_NAME}'"
git push
fi
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@v4
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"