Skip to content

Publish release

Publish release #541

name: Publish release
on:
workflow_dispatch:
jobs:
publish-release:
name: Publish Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '8'
- name: Set version env variable
id: version-set
run: |
VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
RELEASE_VERSION=(${VERSION//-/ })
RELEASE_VERSION=${RELEASE_VERSION[0]}
SPLIT=(${RELEASE_VERSION//./ })
NEXT_SUB_VERSION=$(( SPLIT[2] + 1 ))
NEXT_DEV_VERSION="${SPLIT[0]}.${SPLIT[1]}.$NEXT_SUB_VERSION-SNAPSHOT"
TAGGED_VERSION=$RELEASE_VERSION
echo VERSION=$RELEASE_VERSION >> $GITHUB_ENV
echo GIT_TAG=$TAGGED_VERSION >> $GITHUB_ENV
echo NEXT_DEV_VERSION=$NEXT_DEV_VERSION >> $GITHUB_ENV
echo "::set-output name=version::$RELEASE_VERSION"
echo "::set-output name=taggedVersion::$TAGGED_VERSION"
echo "::set-output name=nextDevVersion::$NEXT_DEV_VERSION"
- name: Pre release depenency version update
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
echo "Version: ${VERSION}"
echo "Tagged Version: ${GIT_TAG}"
echo "Next Developer Version: ${NEXT_DEV_VERSION}"
git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
git checkout -b release-${GIT_TAG}
- name: Publish artifact
run: |
mvn --version
mvn -e -B -s settings.xml release:prepare release:perform -B -Darguments="-Dmaven.test.skip=true" -P \
wso2-release2 -DreleaseVersion=$VERSION -Dtag=$RELEASE_TAG -DdevelopmentVersion=$NEXT_DEV_VERSION
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
RELEASE_TAG: "v${{ steps.version-set.outputs.taggedVersion }}"
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
tag_name: "v${{ steps.version-set.outputs.taggedVersion }}"
release_name: ${{ steps.version-set.outputs.taggedVersion }}
draft: false
prerelease: true
- name: Create linux-deb Installer
id: run_installers_deb
run: ./build-ballerina-linux-deb-x64.sh -v ${{ steps.version-set.outputs.version }} -p ./../../ballerina/target
working-directory: installers/linux-deb
- name: Create linux-rpm Installer
id: run_installers_rpm
run: ./build-ballerina-linux-rpm-x64.sh -v ${{ steps.version-set.outputs.version }} -p ./../../ballerina/target
working-directory: installers/linux-rpm
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.deb.sha256 installers/linux-deb/target/ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.deb
openssl dgst -sha256 -out ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.rpm.sha256 installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.rpm
openssl dgst -sha256 -out ballerina-${{ steps.version-set.outputs.version }}.zip.sha256 ballerina/target/ballerina-${{ steps.version-set.outputs.version }}.zip
openssl dgst -sha256 -out jballerina-${{ steps.version-set.outputs.version }}.zip.sha256 ballerina/target/jballerina-${{ steps.version-set.outputs.version }}.zip
- name: Upload ballerina zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.version }}.zip
asset_path: ballerina/target/ballerina-${{ steps.version-set.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: Upload jballerina zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: jballerina-${{ steps.version-set.outputs.version }}.zip
asset_path: ballerina/target/jballerina-${{ steps.version-set.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: Upload Linux deb Installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.deb
asset_path: installers/linux-deb/target/ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.deb
asset_content_type: application/octet-stream
- name: Upload Linux rpm Installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.rpm
asset_path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.rpm
asset_content_type: application/octet-stream
- name: Upload MacOS zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-macos-${{ steps.version-set.outputs.version }}.zip
asset_path: ballerina/target/ballerina-macos-${{ steps.version-set.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: Upload Windows zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-windows-${{ steps.version-set.outputs.version }}.zip
asset_path: ballerina/target/ballerina-windows-${{ steps.version-set.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: Upload Linux deb Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.deb.sha256
asset_path: ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.deb.sha256
asset_content_type: application/octet-stream
- name: Upload Linux rpm Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.rpm.sha256
asset_path: ballerina-linux-installer-x64-${{ steps.version-set.outputs.version }}.rpm.sha256
asset_content_type: application/octet-stream
- name: Upload Ballerina zip Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.version }}.zip.sha256
asset_path: ballerina-${{ steps.version-set.outputs.version }}.zip.sha256
asset_content_type: application/octet-stream
- name: Upload jballerina zip Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: jballerina-${{ steps.version-set.outputs.version }}.zip.sha256
asset_path: jballerina-${{ steps.version-set.outputs.version }}.zip.sha256
asset_content_type: application/octet-stream
- name: Checkout docker repo
uses: actions/checkout@v2
with:
repository: ballerina-platform/module-ballerina-docker
ref: ballerina-1.2.x
path: module-ballerina-docker
- name: Copy zip artifact
run: cp ballerina/target/ballerina-${{ steps.version-set.outputs.version }}.zip module-ballerina-docker/base/docker/
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build the docker image
id: docker_build
uses: docker/build-push-action@v2
with:
context: module-ballerina-docker/base/docker/
load: true
push: false
tags: ballerina/ballerina:release-test
build-args: |
BALLERINA_DIST=ballerina-${{ steps.version-set.outputs.version }}.zip
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ballerina/ballerina:release-test'
skip-dirs: 'ballerina/runtime/examples'
format: 'table'
exit-code: '1'
timeout: "10m0s"
# - name: Post release PR
# env:
# GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
# run: |
# curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
# bin/hub pull-request -m "[Automated] Sync master after "$VERSION" release"
outputs:
project-version: ${{ steps.version-set.outputs.version }}
upload-asset-url: ${{ steps.create_release.outputs.upload_url }}
release-version: ${{ steps.version-set.outputs.taggedVersion }}
macos-installer-build:
name: MacOS Installer Build
needs: publish-release
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Download MacOS Intaller Zip
run: wget https://github.com/ballerina-platform/ballerina-distribution/releases/download/v${{ needs.publish-release.outputs.release-version }}/ballerina-macos-${{ needs.publish-release.outputs.project-version }}.zip
- name: Create macos-pkg Installer
id: run_installers_pkg
run: ./build-ballerina-macos-x64.sh -v ${{ needs.publish-release.outputs.project-version }} -p ./../../
working-directory: installers/mac
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-macos-installer-x64-${{ needs.publish-release.outputs.project-version }}.pkg.sha256 installers/mac/target/pkg/ballerina-macos-installer-x64-${{ needs.publish-release.outputs.project-version }}.pkg
- name: Upload MacOS pkg Installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-macos-installer-x64-${{ needs.publish-release.outputs.project-version }}.pkg
asset_path: installers/mac/target/pkg/ballerina-macos-installer-x64-${{ needs.publish-release.outputs.project-version }}.pkg
asset_content_type: application/octet-stream
- name: Upload MacOS pkg Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-macos-installer-x64-${{ needs.publish-release.outputs.project-version }}.pkg.sha256
asset_path: ballerina-macos-installer-x64-${{ needs.publish-release.outputs.project-version }}.pkg.sha256
asset_content_type: application/octet-stream
windows-installer-build:
name: Windows Installer Build
needs: publish-release
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.1.x'
- name: Install GUID Generator
run: dotnet tool install -g dotnet-guid --version 0.5.2
- name: Set up Wix toolkit
run: echo "${WIX}bin" >> $GITHUB_PATH
shell: bash
- name: Download Windows Installer Zip
run: |
echo default login ${{ secrets.BALLERINA_BOT_USERNAME }} password ${{ secrets.BALLERINA_BOT_TOKEN }} >> _netrc
curl --netrc-file _netrc -L -o ballerina-${{ needs.publish-release.outputs.project-version }}-windows.zip https://github.com/ballerina-platform/ballerina-distribution/releases/download/v${{ needs.publish-release.outputs.release-version }}/ballerina-${{ needs.publish-release.outputs.project-version }}-windows.zip
- name: Create windows-msi Installer
id: run_installers_msi
run: |
move installers\windows .\
ren windows w
cd w
.\build-ballerina-windows-x64.bat --version ${{ needs.publish-release.outputs.project-version }} --path .\..\
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-windows-installer-x64-${{ needs.publish-release.outputs.project-version }}.msi.sha256 w\target\msi\ballerina-windows-installer-x64-${{ needs.publish-release.outputs.project-version }}.msi
- name: Upload Windows msi Installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-windows-installer-x64-${{ needs.publish-release.outputs.project-version }}.msi
asset_path: w\target\msi\ballerina-windows-installer-x64-${{ needs.publish-release.outputs.project-version }}.msi
asset_content_type: application/octet-stream
- name: Upload Windows msi Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-windows-installer-x64-${{ needs.publish-release.outputs.project-version }}.msi.sha256
asset_path: ballerina-windows-installer-x64-${{ needs.publish-release.outputs.project-version }}.msi.sha256
asset_content_type: application/octet-stream