diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a0bbdf05ea..e7a3b81f28 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -17,7 +17,7 @@ jobs: - name: Set up Maven Central Repository uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 11 server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD @@ -28,27 +28,22 @@ jobs: - uses: actions/setup-python@v2 with: python-version: 3.8 - - # Set publish target as either of all targets, python sdk, java sdk or migration tools + + # Set publish target as either of all targets, python sdk or java sdk - name: Set publish target id: publish_target run: | - echo "::set-output name=PUBLISH_ALL_TARGET::true" - echo "::set-output name=TAG_NAME::${{ github.event.release.tag_name }}" - if [[ ${{ github.event.release.tag_name }} == *"migration-tool"* ]]; then - echo "::set-output name=PUBLISH_MIGRATION_TARGET::true" - echo "::set-output name=PUBLISH_SDK_TARGET::false" - echo "::set-output name=PUBLISH_ALL_TARGET::false" - elif [[ ${{ github.event.release.tag_name }} == *"java-sdk"* ]] || [[ ${{ github.event.release.tag_name }} == *"python-sdk"* ]]; then - echo "::set-output name=PUBLISH_MIGRATION_TARGET::false" - echo "::set-output name=PUBLISH_SDK_TARGET::true" - echo "::set-output name=PUBLISH_ALL_TARGET::false" - fi + echo "PUBLISH_ALL_TARGET=true" >> "$GITHUB_OUTPUT" + echo "TAG_NAME=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" + if [[ ${{ github.event.release.tag_name }} == *"python-sdk"* ]]; then + echo "PUBLISH_ALL_TARGET=false" >> "$GITHUB_OUTPUT" + elif [[ ${{ github.event.release.tag_name }} == *"java-sdk"* ]]; then + echo "PUBLISH_ALL_TARGET=false" >> "$GITHUB_OUTPUT" - name: Get the version id: get_sdk_version run: | - echo "::set-output name=AVI_VERSION::$(python ./python/version.py)" + echo "AVI_VERSION=$(python ./python/version.py)" >> "$GITHUB_OUTPUT" JAVA_VERSION=$(echo ${GITHUB_REF##*/} | cut -d - -f 2) if [[ "$JAVA_VERSION" == *"post"* ]]; then echo "Java version post" @@ -61,10 +56,10 @@ jobs: JAVA_VERSION=$JAVA_VERSION.RELEASE fi echo "Java version ${JAVA_VERSION}" - echo "::set-output name=JAVA_RELEASE_VERSION::${JAVA_VERSION}" + echo "JAVA_RELEASE_VERSION=${JAVA_VERSION}" >> "$GITHUB_OUTPUT" - if: steps.publish_target.outputs.PUBLISH_ALL_TARGET == 'true' || contains(steps.publish_target.outputs.TAG_NAME, 'java-sdk') - name: Publish JAVA + name: Publish JAVA Packages run: | echo "Publish Java Version ${{ steps.get_sdk_version.outputs.JAVA_RELEASE_VERSION }}" echo "Publish AVI VERSION ${{ steps.get_sdk_version.outputs.AVI_VERSION }}" @@ -84,7 +79,7 @@ jobs: cp java/target/avisdk-${{ steps.get_sdk_version.outputs.JAVA_RELEASE_VERSION }}-sources.jar . # Installs and upgrades pip, installs other dependencies and installs the package from setup.py - - if: steps.publish_target.outputs.PUBLISH_ALL_TARGET == 'true' || contains(steps.publish_target.outputs.TAG_NAME, 'python-sdk') || steps.publish_target.outputs.PUBLISH_MIGRATION_TARGET == 'true' + - if: steps.publish_target.outputs.PUBLISH_ALL_TARGET == 'true' || contains(steps.publish_target.outputs.TAG_NAME, 'python-sdk') name: "Installs and upgrades pip, installs other dependencies and installs the package from setup.py" run: | AVI_VERSION=`python ./python/version.py` @@ -98,27 +93,19 @@ jobs: # If requirements.txt exists, install from it cd python mkdir dist - if [[ ${{ steps.publish_target.outputs.PUBLISH_ALL_TARGET }} == true ]] || [[ ${{ steps.publish_target.outputs.PUBLISH_SDK_TARGET }} == true ]]; then - ./create_sdk_pip_packages.sh sdk - elif [[ ${{ steps.publish_target.outputs.PUBLISH_ALL_TARGET }} == true ]] || [[ ${{ steps.publish_target.outputs.PUBLISH_MIGRATION_TARGET }} == true ]]; then - ./create_sdk_pip_packages.sh migrationtools - fi + ./create_sdk_pkgs.sh + ./create_sdk_pip_packages.sh sdk if [[ ${{ steps.publish_target.outputs.TAG_NAME }} == "test-"* ]]; then echo "Test tag found. Skipping python assets upload to public repo." else echo "Normal tag found. Uploading python assets to public repo." ./create_sdk_pypi.sh sdk fi - ./create_sdk_pkgs.sh echo "AVI VERSION=== $AVI_VERSION" ls dist/ - if [[ ${{ steps.publish_target.outputs.PUBLISH_ALL_TARGET }} == true ]] || [[ ${{ steps.publish_target.outputs.PUBLISH_MIGRATION_TARGET }} == true ]]; then - mv dist/avimigrationtools-$AVI_VERSION.tar.gz ../avimigrationtools-$AVI_VERSION.tar.gz - elif [[ ${{ steps.publish_target.outputs.PUBLISH_ALL_TARGET }} == true ]] || [[ ${{ steps.publish_target.outputs.PUBLISH_SDK_TARGET }} == true ]]; then - mv dist/avisdk-$AVI_VERSION.tar.gz ../avisdk-$AVI_VERSION.tar.gz - #mv dist/python-avisdk_0_all.deb ../avisdk-$AVI_VERSION.deb - mv dist/avisdk-$AVI_VERSION-1.noarch.rpm ../avisdk-$AVI_VERSION.rpm - fi + mv dist/avisdk-$AVI_VERSION.tar.gz ../avisdk-$AVI_VERSION.tar.gz + #mv dist/python-avisdk_0_all.deb ../avisdk-$AVI_VERSION.deb + mv dist/avisdk-$AVI_VERSION-1.noarch.rpm ../avisdk-$AVI_VERSION.rpm env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }} @@ -141,17 +128,6 @@ jobs: asset_name: pip-package-avisdk-${{ steps.get_sdk_version.outputs.AVI_VERSION }}.tar.gz asset_content_type: application/gzip - - if: steps.publish_target.outputs.PUBLISH_ALL_TARGET == 'true' || steps.publish_target.outputs.PUBLISH_MIGRATION_TARGET == 'true' - name: Upload Avi Migration Tools pip package - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.github_token }} - with: - upload_url: ${{ steps.update_release.outputs.upload_url }} - asset_path: avimigrationtools-${{ steps.get_sdk_version.outputs.AVI_VERSION }}.tar.gz - asset_name: pip-package-avimigrationtools-${{ steps.get_sdk_version.outputs.AVI_VERSION }}.tar.gz - asset_content_type: application/gzip - #- name: Upload Avi API SDK debian package # uses: actions/upload-release-asset@v1 # env: