Release Workflow #120
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 Workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
release-version: | |
description: 'Version being released' | |
required: true | |
snapshot-version: | |
description: 'Next snapshot version' | |
required: true | |
branch: | |
description: 'Branch to release from' | |
required: true | |
default: 'main' | |
jobs: | |
release: | |
runs-on: ubuntu-22.04 | |
if: github.repository_owner == 'Apicurio' | |
env: | |
IS_PRE_RELEASE: false | |
steps: | |
- name: Log Metadata | |
run: | | |
echo "Releasing Apicurio Registry version ${{ github.event.inputs.release-version }} from branch ${{ github.event.inputs.branch }}" | |
echo "Next Snapshot version will be ${{ github.event.inputs.snapshot-version }}" | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set up Node.js v18 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
- name: Set up json CLI | |
run: npm install -g json | |
- name: Set up Gren | |
run: npm install -g github-release-notes | |
- name: Import GPG Key | |
uses: crazy-max/ghaction-import-gpg@f6f458f535f4ccdf100400ee0755c0e857226a66 | |
env: | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Apicurio Registry Checkout | |
run: | | |
mkdir registry | |
cd registry | |
git init | |
git config --global user.name "apicurio-ci" | |
git config --global user.email "[email protected]" | |
git remote add origin "https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apicurio/apicurio-registry.git" | |
git fetch | |
git checkout ${{ github.event.inputs.branch }} | |
git branch --set-upstream-to=origin/${{ github.event.inputs.branch }} | |
git pull | |
- name: Update Release Version ${{ github.event.inputs.release-version}} | |
run: | | |
cd registry | |
mvn versions:set -DnewVersion=${{ github.event.inputs.release-version}} -DgenerateBackupPoms=false -DprocessAllModules=true | |
# take only the major and minor versions from release-version and then append .x. | |
DOCS_VERSION=$(echo "${{ github.event.inputs.release-version}}" | awk -F '[.-]' '{print $1"."$2".x"}') | |
sed -i "s/version\:\s.*/version: \'${DOCS_VERSION}\'/g" docs/antora.yml | |
sed -i "5s/\"version\"\:\s\".*\"/\"version\": \"${DOCS_VERSION}\"/g" app/src/main/resources-unfiltered/META-INF/resources/api-specifications/registry/v3/openapi.json | |
# take only the major, minor and patch | |
PYTHON_SDK_VERSION=$(echo "${{ github.event.inputs.release-version}}" | awk -F '[.-]' '{print $1"."$2"."$3}') | |
sed -i "s/^version.*/version \= \"${PYTHON_SDK_VERSION}\"/" python-sdk/pyproject.toml | |
# take only the major, minor and patch | |
UI_VERSION=$(echo "${{ github.event.inputs.release-version}}" | awk -F '[.-]' '{print $1"."$2"."$3}') | |
cd ui | |
npm version $UI_VERSION --allow-same-version | |
cd ui-app | |
npm version $UI_VERSION --allow-same-version | |
json -I -f package.json -e "this.dependencies[\"@apicurio/apicurio-registry-sdk\"]=\"$UI_VERSION\"" | |
cd ../ui-docs | |
npm version $UI_VERSION --allow-same-version | |
cd ../tests | |
npm version $UI_VERSION --allow-same-version | |
cd ../../typescript-sdk | |
npm version $UI_VERSION --allow-same-version | |
- name: Build Registry (All Variants) | |
run: | | |
cd registry | |
./mvnw clean package --no-transfer-progress -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5 | |
- name: Build Registry UI | |
working-directory: registry/ui | |
run: | | |
npm install | |
npm run lint | |
npm run build | |
npm run package | |
- name: Commit Release Version Change | |
run: | | |
cd registry | |
git add . | |
git commit -m "Automated update to Release Version:: ${{ github.event.inputs.release-version}}" | |
git push | |
- name: Determine Release Type | |
if: "contains(github.event.inputs.release-version, 'RC')" | |
run: | | |
echo "This is a pre-release. Setting environment variable 'IS_PRE_RELEASE' to true" | |
echo "IS_PRE_RELEASE=true" >> $GITHUB_ENV | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 | |
with: | |
name: ${{ github.event.inputs.release-version }} | |
tag_name: ${{ github.event.inputs.release-version }} | |
token: ${{ secrets.ACCESS_TOKEN }} | |
target_commitish: ${{ github.event.inputs.branch }} | |
prerelease: ${{ env.IS_PRE_RELEASE }} | |
files: | | |
registry/distro/docker/target/docker/app-files/apicurio-registry-app-${{ github.event.inputs.release-version }}-all.tar.gz | |
- name: Generate Release Notes | |
run: | | |
cd registry | |
gren release --token=${{ secrets.GITHUB_TOKEN }} --override | |
- name: Update Snapshot Version ${{ github.event.inputs.snapshot-version}} | |
run: | | |
cd registry | |
mvn versions:set -DnewVersion=${{ github.event.inputs.snapshot-version}} -DgenerateBackupPoms=false -DprocessAllModules=true | |
# take only the major and minor versions from snapshot-version and then append .x. | |
DOCS_VERSION=$(echo "${{ github.event.inputs.snapshot-version}}" | awk -F '[.-]' '{print $1"."$2".x"}') | |
sed -i "s/version\:\s.*/version: \'${DOCS_VERSION}\'/g" docs/antora.yml | |
sed -i "5s/\"version\"\:\s\".*\"/\"version\": \"${DOCS_VERSION}\"/g" app/src/main/resources-unfiltered/META-INF/resources/api-specifications/registry/v3/openapi.json | |
# take only the major, minor and patch | |
PYTHON_SDK_VERSION=$(echo "${{ github.event.inputs.snapshot-version}}" | awk -F '[.-]' '{print $1"."$2"."$3}') | |
sed -i "s/^version.*/version \= \"${PYTHON_SDK_VERSION}\"/" python-sdk/pyproject.toml | |
# take only the major, minor and patch | |
UI_VERSION=$(echo "${{ github.event.inputs.snapshot-version}}" | awk -F '[.-]' '{print $1"."$2"."$3}-Dev') | |
cd ui | |
npm version $UI_VERSION --allow-same-version | |
cd ui-app | |
npm version $UI_VERSION --allow-same-version | |
json -I -f package.json -e "this.dependencies[\"@apicurio/apicurio-registry-sdk\"]=\"$UI_VERSION\"" | |
cd ../ui-docs | |
npm version $UI_VERSION --allow-same-version | |
cd ../tests | |
npm version $UI_VERSION --allow-same-version | |
cd ../../typescript-sdk | |
npm version $UI_VERSION --allow-same-version | |
- name: Commit Snapshot Version ${{ github.event.inputs.snapshot-version}} | |
run: | | |
cd registry | |
git add . | |
git commit -m "Automated update to next Snapshot Version: ${{ github.event.inputs.snapshot-version}}" | |
git push | |
- name: Google Chat Notification (Always) | |
if: always() | |
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1 | |
with: | |
name: ${{ github.job }} | |
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }} | |
status: ${{ job.status }} | |
- name: Google Chat Notification (Error) | |
if: failure() | |
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1 | |
with: | |
name: ${{ github.job }} | |
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_ERRORS }} | |
status: ${{ job.status }} |