Skip to content

v1.18.0-rc3

v1.18.0-rc3 #9

name: Push API Changes to solo-apis
on:
release:
types: [published]
# This job has flaked on releases. We enable manually triggering the workflow
# so that developers do not need to run this step manually when a flake occurs
workflow_dispatch:
inputs:
source-branch:
# The name of your remote branch that contains the API changes you would like to mirror
description: 'The branch that contains the relevant API change'
required: true
default: ''
target-branch:
# The name of the remote branch that you would like to merge these API changes into (ie v1.13.x)
description: 'The LTS branch that these API changes are targeted for'
required: true
default: ''
jobs:
prepare-env:
name: Prepare Environment Variables
runs-on: ubuntu-22.04
timeout-minutes: 5
outputs:
# The Gloo Commit ID that contains the changes we are attempting to mirror
# On a manual trigger, this is branch name with your changes
# On a release, this is the tag for the release commit (ie v1.13.0)
source-commit: ${{ steps.source-commit.outputs.value }}
# The LTS branch that we are targeting these changes for (ie v1.13.x)
target-branch: ${{ steps.target-branch.outputs.value }}
# The prefix used to differentiate LTS branches in solo-apis
solo-apis-prefix: 'gloo'
steps:
- id: source-commit
run: |
SOURCE_COMMIT=${{ github.event.inputs.source-branch }}
if [[ ${{ github.event_name == 'release' }} = true ]]; then
SOURCE_COMMIT=${{ github.event.release.tag_name }}
fi
echo "value=$SOURCE_COMMIT" >> $GITHUB_OUTPUT
- id: target-branch
run: |
TARGET_BRANCH=${{ github.event.inputs.target-branch }}
if [[ ${{ github.event_name == 'release' }} = true ]]; then
TARGET_BRANCH=${{ github.event.release.target_commitish }}
fi
echo "value=$TARGET_BRANCH" >> $GITHUB_OUTPUT
push-to-solo-apis-branch:
needs: prepare-env
env:
SOURCE_COMMIT: ${{ needs.prepare-env.outputs.source-commit }}
TARGET_BRANCH: ${{ needs.prepare-env.outputs.target-branch }}
SOLO_APIS_PREFIX: ${{ needs.prepare-env.outputs.solo-apis-prefix }}
name: Publish Gloo APIs
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Install SSH Deploy key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SOLO_API_DEPLOY_KEY }}
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
repository: solo-io/gloo
path: gloo
ref: ${{ env.SOURCE_COMMIT }}
- name: Set up Go
uses: actions/setup-go@v5
with:
cache: false
go-version-file: gloo/go.mod
id: go
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: "3.6.1"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
repository: solo-io/solo-apis
path: solo-apis
# Checkout the solo-apis LTS branch that tracks the Gloo LTS branch
# NOTE: This will fail if the solo-apis LTS branch does not exist.
ref: '${{env.SOLO_APIS_PREFIX}}-${{ env.TARGET_BRANCH }}'
- name: Update solo-apis
env:
# The LTS branch in solo-apis that will hold the published apis (ie gloo-v1.8.x)
SOLO_APIS_DESTINATION_BRANCH: '${{env.SOLO_APIS_PREFIX}}-${{ env.TARGET_BRANCH }}'
# The branch that this GHA will commit to.
# The branch name fits the following shape: sync-apis/${SOLO_API_LTS_BRANCH}/${SOURCE_COMMIT}
# Using this structure, the solo-apis repo can run actions to generate pull requests to the proper LTS branch
# and tag those branches after they merge.
# For example, releasing v1.8.0 will create a pull request:
# gloo-v1.13.x <-- sync-apis/gloo-v1.13.x/gloo-v1.13.0
SOLO_APIS_SOURCE_BRANCH: 'sync-apis/${{ env.SOLO_APIS_PREFIX }}-${{ env.TARGET_BRANCH }}/${{ env.SOLO_APIS_PREFIX }}-${{ env.SOURCE_COMMIT }}'
GIT_USER_NAME: soloio-bot
GIT_USER_EMAIL: [email protected]
run: |
cd solo-apis
make mod-download update-deps; ./hack/sync-gloo-apis.sh; make generate
git config --local user.name $GIT_USER_NAME
git config --local user.email $GIT_USER_EMAIL
git add .
git checkout -B $SOLO_APIS_SOURCE_BRANCH
git commit -m "Sync Gloo APIs. Destination Branch: $SOLO_APIS_DESTINATION_BRANCH" --allow-empty
git remote add solo-apis [email protected]:solo-io/solo-apis.git
git push solo-apis $SOLO_APIS_SOURCE_BRANCH