Fix issue 1532 bump grpc version from 1.58.2 to 1.58.3 (#1535) #438
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
workflow_dispatch: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
pull_request: | |
jobs: | |
test: | |
name: Test/Cover | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
- name: Go caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ github.job }}-${{ runner.os }}-go- | |
# XSLTTransformation needs libxml2. | |
- name: Install libxml2 | |
run: sudo apt-get update && sudo apt install -y libxml2-dev libxslt1-dev liblzma-dev zlib1g-dev | |
- name: Run test/cover | |
run: WITH_DEPENDENCIES=true make cover | |
env: | |
TEST_OUTPUT_DIR: /tmp/test-results/ | |
COVER_OUTPUT_DIR: /tmp/cover-results/ | |
publish-images: | |
name: Build and publish images | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest-8-cores | |
needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
- name: Go caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ github.job }}-${{ runner.os }}-go- | |
- name: Installing ko | |
run: go install github.com/google/ko@v0.11.2 | |
- name: Login to GCR | |
uses: docker/login-action@v3 | |
with: | |
registry: gcr.io | |
username: _json_key | |
password: ${{ secrets.GCLOUD_GCR_SERVICEACCOUNT_KEY }} | |
- name: Set IMAGE_TAG | |
id: image-tag | |
run: | | |
IMAGE_TAG=${GITHUB_SHA} | |
[[ ${GITHUB_REF_TYPE} == "tag" ]] && IMAGE_TAG=${GITHUB_REF_NAME} | |
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT | |
- name: Publish container images to GCR | |
env: | |
KO_DOCKER_REPO: gcr.io/triggermesh | |
DIST_DIR: /tmp/dist | |
run: | | |
pushd hack/manifest-cleaner | |
go install . | |
popd | |
if [[ ${GITHUB_REF_TYPE} == "tag" ]]; then | |
export KOFLAGS='--jobs=2 --platform=linux/amd64,linux/arm64,linux/ppc64le --push=${{ github.event_name != 'pull_request' }}' | |
else | |
export KOFLAGS='--jobs=2 --platform=linux/amd64 --push=${{ github.event_name != 'pull_request' }}' | |
fi | |
IMAGE_TAG=${{ steps.image-tag.outputs.IMAGE_TAG }} make release | |
declare -a release_files=( | |
triggermesh-crds.yaml | |
triggermesh.yaml | |
) | |
for f in "${release_files[@]}"; do | |
manifest-cleaner <"${DIST_DIR}/${f}" >"${DIST_DIR}/${f}.clean" | |
mv "${DIST_DIR}/${f}.clean" "${DIST_DIR}/${f}" | |
done | |
- name: Upload artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: manifests | |
path: /tmp/dist | |
retention-days: 14 | |
update-config: | |
if: ${{ github.event_name != 'pull_request' }} | |
name: Update Config Manifests | |
runs-on: ubuntu-latest | |
needs: publish-images | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Checkout triggermesh/config | |
uses: actions/checkout@v4 | |
with: | |
path: 'tm-config' | |
ref: 'main' | |
repository: 'triggermesh/config' | |
token: ${{ secrets.TM_CONFIG_TOKEN }} | |
- name: Set IMAGE_TAG | |
id: image-tag | |
run: | | |
IMAGE_TAG=${GITHUB_SHA} | |
[[ ${GITHUB_REF_TYPE} == "tag" ]] && IMAGE_TAG=${GITHUB_REF_NAME} | |
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT | |
- name: Prepare updates | |
working-directory: tm-config | |
run: | | |
sed -i overlays/staging/triggermesh-core/kustomization.yaml -e "s|github.com/triggermesh/triggermesh\(?ref=.*\)\?|github.com/triggermesh/triggermesh?ref="${{ steps.image-tag.outputs.IMAGE_TAG }}"|g" | |
if [[ ${{ steps.image-tag.outputs.IMAGE_TAG }} =~ ^v([0-9]{1,}\.){2}[0-9]{1,}$ ]]; then | |
sed -i overlays/prod/triggermesh-core/kustomization.yaml -e "s|github.com/triggermesh/triggermesh\(?ref=.*\)\?|github.com/triggermesh/triggermesh?ref="${{ steps.image-tag.outputs.IMAGE_TAG }}"|g" | |
fi | |
for cmd in ${GITHUB_WORKSPACE}/cmd/*; do | |
sed -i overlays/staging/triggermesh-core/deployments.yaml -e "s|gcr.io/triggermesh/${cmd##*/}:.*|gcr.io/triggermesh/${cmd##*/}:"${{ steps.image-tag.outputs.IMAGE_TAG }}"|g" | |
if [[ ${{ steps.image-tag.outputs.IMAGE_TAG }} =~ ^v([0-9]{1,}\.){2}[0-9]{1,}$ ]]; then | |
sed -i overlays/prod/triggermesh-core/deployments.yaml -e "s|gcr.io/triggermesh/${cmd##*/}:.*|gcr.io/triggermesh/${cmd##*/}:"${{ steps.image-tag.outputs.IMAGE_TAG }}"|g" | |
fi | |
done | |
git --no-pager diff | |
- name: Commit and push changes | |
working-directory: tm-config | |
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 triggermesh-core deployment to ref '${{ steps.image-tag.outputs.IMAGE_TAG }}'" | |
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: Download artifact | |
uses: actions/download-artifact@master | |
with: | |
name: manifests | |
path: /tmp/dist | |
- name: Preparing Release Notes | |
run: | | |
./hack/release-notes.sh ${GITHUB_REF_NAME} > release-notes.md | |
- name: Creating Release | |
uses: ncipollo/release-action@v1 | |
with: | |
bodyFile: "release-notes.md" | |
artifacts: "/tmp/dist/*" | |
# trigger-e2e: | |
# name: Trigger E2E Tests | |
# if: github.event_name != 'pull_request' | |
# needs: publish-images | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Set IMAGE_TAG | |
# id: image-tag | |
# run: | | |
# IMAGE_TAG=${GITHUB_SHA} | |
# [[ ${GITHUB_REF_TYPE} == "tag" ]] && IMAGE_TAG=${GITHUB_REF_NAME} | |
# echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT | |
# - name: Send dispatch event | |
# run: | | |
# curl \ | |
# -X POST \ | |
# -H "Accept: application/vnd.github+json" \ | |
# -H "Authorization: token ${{ secrets.GH_DISPATCH_TOKEN }}" \ | |
# https://api.github.com/repos/triggermesh/triggermesh/dispatches \ | |
# -d '{"event_type":"e2e-test","client_payload":{"commit_sha":"'${GITHUB_SHA}'", "image_tag":"'${{ steps.image-tag.outputs.IMAGE_TAG }}'"}}' |