This repository was archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
130 lines (112 loc) · 3.4 KB
/
build-and-release.yaml
File metadata and controls
130 lines (112 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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 'bot@triggermesh.com'
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"