diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index e1f172e225..112c3d7060 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -13,7 +13,7 @@ on: default: '' permissions: - id-token: write + id-token: write contents: write jobs: @@ -22,17 +22,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 with: distribution: 'temurin' - java-version: '17.0.7' + java-version: '11' - name: Set version env variable id: version-set run: | SHORT_VERSION=$((grep -w 'version' | cut -d= -f2 | cut -d- -f1) < gradle.properties) DIST_VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev) + LANG_VERSION=$((grep -w "ballerinaLangVersion" | cut -d= -f2 | cut -d- -f1 | xargs) < gradle.properties) CODE_NAME=$((grep -w 'codeName' | cut -d= -f2) < gradle.properties) RELEASE_VERSION=$DIST_VERSION TAGGED_VERSION=$RELEASE_VERSION @@ -46,6 +47,7 @@ jobs: echo "::set-output name=sversion::$SHORT_VERSION" echo "::set-output name=taggedVersion::$TAGGED_VERSION" echo "::set-output name=longVersion::$LONG_VERSION" + echo "::set-output name=langversion::$LANG_VERSION" - name: Pre release depenency version update env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -71,13 +73,12 @@ jobs: packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }} - githubAccessToken: ${{ secrets.GITHUB_TOKEN }} ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }} run: | ./gradlew build -Pversion=${VERSION} ./gradlew release -Prelease.useAutomaticVersion=true -x test - name: Checkout docker repo - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: repository: ballerina-platform/module-ballerina-docker path: module-ballerina-docker @@ -120,33 +121,28 @@ jobs: run: | npm install -g github-cli gh --version - - name: Get Markdown file - id: file-url - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh repo view ballerina-platform/ballerina-dev-website --json url --jq '.clone_url' - gh api repos/ballerina-platform/ballerina-dev-website/contents/downloads/verify-ballerina-artifacts.md -H 'Accept: application/vnd.github.v3.raw' > release_notes.md - sed -i '1,10d' release_notes.md - - name: Retrieve Branch - id: retrieve-branch - run: | - branchName=$(echo ${{ github.ref }} | cut -d'/' -f3) - echo "::set-output name=branchName::$branchName" - - name: Update Markdown file - run: | - if ${{ github.event.inputs.isPreRelease }} == 'true'; then - echo "" > release_notes.md; - else sed -i 's/{{ version }}/${{ steps.version-set.outputs.taggedVersion }}/g' release_notes.md; sed -i 's/{{ branch }}/${{ steps.retrieve-branch.outputs.branchName }}/g' release_notes.md; fi - - name: Read release notes from file - id: release_notes - uses: actions/github-script@v4 - with: - github-token: ${{ secrets.BALLERINA_BOT_TOKEN }} - script: | - const fs = require('fs'); - const releaseNotes = fs.readFileSync('release_notes.md', 'utf8'); - core.setOutput('notes', releaseNotes); + # - name: Get Markdown file + # id: file-url + # env: + # GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} + # run: | + # gh repo view ballerina-platform/ballerina-dev-website -b release-2201.7.0 --json url --jq '.clone_url' + # gh api repos/ballerina-platform/ballerina-dev-website/contents/downloads/verify-ballerina-artifacts.md?ref=release-2201.7.0 -H 'Accept: application/vnd.github.v3.raw' > release_notes.md + # - name: Update Markdown file + # run: | + # branchName=$(echo ${{ github.ref }} | cut -d'/' -f3) + # if ${{ github.event.inputs.isPreRelease }} == 'true'; then + # echo "" > release_notes.md; + # else sed -i 's/{{ version }}/${{ steps.version-set.outputs.taggedVersion }}/g' release_notes.md; sed -i 's/{{ branch }}/$branchName/g' release_notes.md; fi + # - name: Read release notes from file + # id: release_notes + # uses: actions/github-script@v4 + # with: + # github-token: ${{ secrets.BALLERINA_BOT_TOKEN }} + # script: | + # const fs = require('fs'); + # const releaseNotes = fs.readFileSync('release_notes.md', 'utf8'); + # core.setOutput('notes', releaseNotes); - name: Create release id: create_release uses: actions/create-release@v1 @@ -155,7 +151,7 @@ jobs: with: tag_name: "v${{ steps.version-set.outputs.taggedVersion }}" release_name: ${{ steps.version-set.outputs.taggedVersion }} - body: ${{ steps.release_notes.outputs.notes }} + # body: ${{ steps.release_notes.outputs.notes }} draft: false prerelease: ${{ github.event.inputs.isPreRelease }} - name: Create linux-deb Installer @@ -211,7 +207,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}.zip asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}.zip asset_content_type: application/octet-stream - - name: Upload zip artifact's Certificate + - name: Upload zip artifact's Certificate uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -220,7 +216,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}.pem asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}.pem asset_content_type: application/octet-stream - - name: Upload zip artifact's Signature + - name: Upload zip artifact's Signature uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -238,7 +234,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.sversion }}.zip asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.sversion }}.zip asset_content_type: application/octet-stream - - name: Upload zip without tool artifact's Certificate + - name: Upload zip without tool artifact's Certificate uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -247,7 +243,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.sversion }}.pem asset_path: ./ballerina-${{ steps.version-set.outputs.sversion }}.pem asset_content_type: application/octet-stream - - name: Upload zip without tool artifact's Signature + - name: Upload zip without tool artifact's Signature uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -265,7 +261,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb asset_path: installers/linux-deb/target/ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb asset_content_type: application/octet-stream - - name: Upload Linux deb Installer's Certificate + - name: Upload Linux deb Installer's Certificate uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -274,7 +270,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.pem asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.pem asset_content_type: application/octet-stream - - name: Upload Linux deb Installer's Signature + - name: Upload Linux deb Installer's Signature uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -292,7 +288,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm asset_path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm asset_content_type: application/octet-stream - - name: Upload Linux rpm Installer's Certificate + - name: Upload Linux rpm Installer's Certificate uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -301,7 +297,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.pem asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.pem asset_content_type: application/octet-stream - - name: Upload Linux rpm Installer's Signature + - name: Upload Linux rpm Installer's Signature uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -319,7 +315,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-macos.zip asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-macos.zip asset_content_type: application/octet-stream - - name: Upload MacOS zip artifact's Certificate + - name: Upload MacOS zip artifact's Certificate uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -328,7 +324,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-macos.pem asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-macos.pem asset_content_type: application/octet-stream - - name: Upload MacOS zip artifact's Signature + - name: Upload MacOS zip artifact's Signature uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -346,7 +342,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.zip asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.zip asset_content_type: application/octet-stream - - name: Upload MacOS-ARM zip artifact's Certificate + - name: Upload MacOS-ARM zip artifact's Certificate uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -355,7 +351,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.pem asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.pem asset_content_type: application/octet-stream - - name: Upload MacOS-ARM zip artifact's Signature + - name: Upload MacOS-ARM zip artifact's Signature uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -373,7 +369,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-windows.zip asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-windows.zip asset_content_type: application/octet-stream - - name: Upload Windows zip artifact's Certificate + - name: Upload Windows zip artifact's Certificate uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -382,7 +378,7 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-windows.pem asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-windows.pem asset_content_type: application/octet-stream - - name: Upload Windows zip artifact's Signature + - name: Upload Windows zip artifact's Signature uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -427,6 +423,19 @@ jobs: asset_name: ballerina-${{ steps.version-set.outputs.sversion }}.zip.sha256 asset_path: ballerina-${{ steps.version-set.outputs.sversion }}.zip.sha256 asset_content_type: application/octet-stream + - name: Install Ballerina DEB + run: sudo dpkg -i installers/linux-deb/target/ballerina-*-linux-x64.deb + - name: Update Installer Test Configs + run: | + DISPLAY_TEXT=${{ steps.project-version.outputs.langversion }} + SWAN_LAKE_LATEST_VERSION="swan-lake-"+$DISPLAY_TEXT + perl -pi -e "s/^\s*swan-lake-latest-version-display-text=.*/swan-lake-latest-version-display-text=$DISPLAY_TEXT/" ballerina-test-automation/gradle.properties + perl -pi -e "s/^\s*swan-lake-latest-version=.*/swan-lake-latest-version=$SWAN_LAKE_LATEST_VERSION/" ballerina-test-automation/gradle.properties + - name: Run Installer Tests + working-directory: ./ballerina-test-automation/installer-test + run: ./../gradlew build --stacktrace -scan --console=plain --no-daemon -DballerinaInstalled=true + env: + TEST_MODE_ACTIVE: true - name: Post release PR env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -438,6 +447,7 @@ jobs: project-version: ${{ steps.version-set.outputs.longVersion }} upload-asset-url: ${{ steps.create_release.outputs.upload_url }} release-version: ${{ steps.version-set.outputs.taggedVersion }} + lang-version: ${{ steps.version-set.outputs.langversion }} macos-installer-build: name: MacOS Installer Build @@ -447,11 +457,11 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v2 - - name: Set up JDK 17 + - name: Set up JDK 11 uses: actions/setup-java@v2 with: distribution: 'temurin' - java-version: '17.0.7' + java-version: '11' - name: Download MacOS Intaller Zip run: | wget https://github.com/ballerina-platform/ballerina-distribution/releases/download/v${{ needs.publish-release.outputs.release-version }}/ballerina-${{ needs.publish-release.outputs.project-version }}-macos.zip @@ -490,7 +500,7 @@ jobs: asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg asset_path: installers/mac/target/pkg/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg asset_content_type: application/octet-stream - - name: Upload MacOS installer's Certificate + - name: Upload MacOS installer's Certificate uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -499,7 +509,7 @@ jobs: asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.pem asset_path: ./ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.pem asset_content_type: application/octet-stream - - name: Upload MacOS installer's Signature + - name: Upload MacOS installer's Signature uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -544,7 +554,7 @@ jobs: asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg asset_path: installers/mac/target/pkg/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg asset_content_type: application/octet-stream - - name: Upload MacOS-ARM installer's Certificate + - name: Upload MacOS-ARM installer's Certificate uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -553,7 +563,7 @@ jobs: asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.pem asset_path: ./ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.pem asset_content_type: application/octet-stream - - name: Upload MacOS-ARM installer's Signature + - name: Upload MacOS-ARM installer's Signature uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -562,6 +572,19 @@ jobs: asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.sig asset_path: ./ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.sig asset_content_type: application/octet-stream + - name: Install Ballerina PKG + run: sudo installer -pkg installers/mac/target/pkg/ballerina-*-macos-x64.pkg -target / + - name: Update Installer Test Configs + run: | + DISPLAY_TEXT=${{ needs.ubuntu-build.outputs.lang-version }} + SWAN_LAKE_LATEST_VERSION="swan-lake-"+$DISPLAY_TEXT + perl -pi -e "s/^\s*swan-lake-latest-version-display-text=.*/swan-lake-latest-version-display-text=$DISPLAY_TEXT/" ballerina-test-automation/gradle.properties + perl -pi -e "s/^\s*swan-lake-latest-version=.*/swan-lake-latest-version=$SWAN_LAKE_LATEST_VERSION/" ballerina-test-automation/gradle.properties + - name: Run Installer Tests + working-directory: ./ballerina-test-automation/installer-test + run: ./../gradlew build --stacktrace -scan --console=plain --no-daemon -DballerinaInstalled=true + env: + TEST_MODE_ACTIVE: true windows-installer-build: name: Windows Installer Build @@ -571,11 +594,11 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v2 - - name: Set up JDK 17 + - name: Set up JDK 11 uses: actions/setup-java@v2 with: distribution: 'temurin' - java-version: '17.0.7' + java-version: '11' - uses: actions/setup-dotnet@v1 with: dotnet-version: '2.1.x' @@ -624,7 +647,7 @@ jobs: asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi asset_path: w\target\msi\ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi asset_content_type: application/octet-stream - - name: Upload Windows installer's Certificate + - name: Upload Windows installer's Certificate uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -633,7 +656,7 @@ jobs: asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.pem asset_path: ./ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.pem asset_content_type: application/octet-stream - - name: Upload Windows installer's Signature + - name: Upload Windows installer's Signature uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} @@ -645,9 +668,14 @@ jobs: - name: Install Ballerina msi run: msiexec /i w\target\msi\ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi /quiet /qr shell: cmd + - name: Update Installer Test Configs + run: | + set DISPLAY_TEXT=${{ needs.publish-release.outputs.lang-version }} + set SWAN_LAKE_LATEST_VERSION=swan-lake-%DISPLAY_TEXT% + perl -pi -e "s/^\s*swan-lake-latest-version-display-text=.*/swan-lake-latest-version-display-text=%DISPLAY_TEXT%/" ballerina-test-automation/gradle.properties + perl -pi -e "s/^\s*swan-lake-latest-version=.*/swan-lake-latest-version=%SWAN_LAKE_LATEST_VERSION%/" ballerina-test-automation/gradle.properties - name: Run Installer Tests working-directory: .\ballerina-test-automation\installer-test run: | $env:Path += ";C:\Program Files\Ballerina\bin" .\..\gradlew build --stacktrace -scan --console=plain --no-daemon -DballerinaInstalled=true - \ No newline at end of file