Update the slot field description and changelog #27
Workflow file for this run
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: NS Messaging library Release and AsyncAPI documents processing | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
setVersion: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: develop | |
- name: Extract version from tag | |
uses: damienaicheh/[email protected] | |
- name: Extract existing version code | |
run: | | |
# Set new version name from tag | |
if [[ -z "${{ env.PATCH }}" ]]; then | |
version_name=${{ env.MAJOR }}.${{ env.MINOR }} | |
else | |
version_name=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }} | |
fi | |
# Set environment variable for later use | |
echo "VERSION_NAME=$version_name" >> $GITHUB_ENV | |
- name: Set version in build.gradle | |
run: | | |
# Update build.gradle with new version | |
echo "${{ env.VERSION_NAME }}" | |
sed -i "s/version \"[^\"]*\"/version \"${{ env.VERSION_NAME }}\"/g" build.gradle | |
- name: Install yq | |
uses: mikefarah/[email protected] | |
- name: Set openapi spec version to tag version using yq | |
run: | | |
echo "${{ env.VERSION_NAME }}" | |
yq e '.info.version = "${{ env.VERSION_NAME }}"' -i src/main/asyncapi/network_survey_messaging.yaml | |
- name: Set version example to tag version using yq | |
run: | | |
echo "${{ env.VERSION_NAME }}" | |
yq e '.components.schemas.version.example = "${{ env.VERSION_NAME }}"' -i src/main/asyncapi/network_survey_messaging.yaml | |
- name: Commit and push changes | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "Github Actions" | |
git add . | |
# Check for changes | |
if git diff --staged --quiet; then | |
echo "No changes to commit" | |
else | |
git commit -m "Bump version to ${{ env.VERSION_NAME }}" | |
git push origin develop | |
fi | |
generateDocs: | |
needs: setVersion | |
runs-on: ubuntu-latest | |
steps: | |
#Check out repo at the created tag | |
- name: Get tag name | |
id: get_tag_name | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.get_tag_name.outputs.VERSION }} | |
#Using another action for AsyncAPI for validation | |
- name: Validating AsyncAPI document | |
uses: WaleedAshraf/[email protected] | |
with: | |
filepath: src/main/asyncapi/network_survey_messaging.yaml | |
#In case you do not want to use defaults, you for example want to use different template | |
- name: Generating HTML from my AsyncAPI document | |
uses: docker://asyncapi/github-action-for-generator:2.1.17 | |
with: | |
template: '@asyncapi/[email protected]' #In case of template from npm, because of @ it must be in quotes | |
filepath: src/main/asyncapi/network_survey_messaging.yaml | |
#parameters: baseHref=/test-experiment/ sidebarOrganization=byTags #space separated list of key/values | |
output: generated-html | |
#Using another action that takes generated HTML and pushes it to GH Pages | |
- name: Deploy GH page | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: generated-html | |
buildRelease: | |
needs: setVersion | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
with: | |
ref: develop | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 8 | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Save GPG Keys | |
env: | |
GPG_FILE: ${{ secrets.GPG_FILE }} | |
run: echo $GPG_FILE | base64 -d > sonatype-secret-keys.gpg | |
- name: Add Gradle Credentials | |
env: | |
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: | | |
./gradlew addCredentials --key sonatypeUsername --value $SONATYPE_USERNAME | |
./gradlew addCredentials --key sonatypePassword --value $SONATYPE_PASSWORD | |
./gradlew addCredentials --key sonatypeKeyPassword --value $GPG_KEY_PASSWORD | |
- name: Create gradle.properties | |
env: | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
run: | | |
echo "signing.keyId=$GPG_KEY_ID" >> gradle.properties | |
echo "signing.secretKeyRingFile=$(pwd)/sonatype-secret-keys.gpg" >> gradle.properties | |
- name: Build and Publish Release Artifacts | |
env: | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: ./gradlew clean build publish | |
- name: Create a Release in GitHub | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "build/libs/*.jar" | |
tag: ${{ steps.version.outputs.content }} | |
commit: ${{ github.sha }} | |
generateReleaseNotes: true | |
draft: false |