Release SDK (Go) #3
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: Release SDK (Go) | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Release tag name' | |
required: true | |
release: | |
types: [released, prereleased] | |
env: | |
# The values are extracted from the github.event context, | |
# which is only available when the workflow gets triggered by a release event. | |
RELEASE_VERSION: ${{ github.event.release.name }} | |
BRANCH: ${{ github.event.release.target_commitish }} | |
jobs: | |
release-sdk: | |
if: github.repository_owner == 'Apicurio' | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 15 | |
env: | |
RELEASE_TYPE: release | |
steps: | |
- name: Fetch Release Details | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
touch release.json && curl https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.event.inputs.tag }} > release.json | |
echo "RELEASE_VERSION=$(cat release.json | jq -r '.name')" >> $GITHUB_ENV | |
echo "BRANCH=$(cat release.json | jq -r '.target_commitish')" >> $GITHUB_ENV | |
- name: Download Source Code | |
run: | | |
git config --global user.name "apicurio-ci" | |
git config --global user.email "[email protected]" | |
git clone --branch $RELEASE_VERSION --single-branch https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apicurio/apicurio-registry.git registry | |
# We have faced issues in the past where a github release was created from a wrong commit | |
# This step will ensure that the release was created from the right commit | |
- name: Verify Project Version | |
run: | | |
cd registry | |
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
if [[ $PROJECT_VERSION != $RELEASE_VERSION ]] | |
then | |
echo "ERROR: Project Version '${PROJECT_VERSION}' does not match with Released Version '${RELEASE_VERSION}'" | |
exit 1 | |
fi | |
- name: Go - Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.20' | |
# Needs special tagging to use submodules: https://stackoverflow.com/a/64705638/7898052 | |
- name: Release Go SDK | |
run: | | |
cd registry | |
git tag "v$RELEASE_VERSION" | |
git tag "go-sdk/v$RELEASE_VERSION" | |
git push origin "v$RELEASE_VERSION" | |
git push origin "go-sdk/v$RELEASE_VERSION" | |
GOPROXY=proxy.golang.org go list -m "github.com/apicurio/apicurio-registry@v$RELEASE_VERSION" | |
if: github.event.inputs.skip-go-sdk == 'false' | |
- name: Google Chat Notification | |
if: ${{ failure() }} | |
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1 | |
with: | |
name: ${{ github.job }} | |
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }} | |
status: ${{ job.status }} |