Publish release #98
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: Publish release | |
on: | |
workflow_dispatch: | |
jobs: | |
publish-release: | |
name: Publish Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set version env variable | |
id: version-set | |
run: | | |
RELEASE_VERSION=$(./gradlew properties | grep ^version: | cut -d\ -f2 | sed 's@-SNAPSHOT@@') | |
echo VERSION=$RELEASE_VERSION >> $GITHUB_ENV | |
echo "::set-output name=version::$RELEASE_VERSION" | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- name: Pre release depenency version update | |
env: | |
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
run: | | |
echo "Version: ${VERSION}" | |
git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }} | |
git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }} | |
git checkout -b release-${VERSION} | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Publish artifact | |
env: | |
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | |
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
run: | | |
./gradlew release -Prelease.useAutomaticVersion=true | |
- 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.version }}" | |
release_name: ${{ steps.version-set.outputs.version }} | |
draft: false | |
prerelease: false | |
- name: Upload 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-command-${{ steps.version-set.outputs.version }}.zip | |
asset_path: build/distributions/ballerina-command-${{ steps.version-set.outputs.version }}.zip | |
asset_content_type: application/octet-stream | |
- name: Upload Linux 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-command-linux-${{ steps.version-set.outputs.version }}.zip | |
asset_path: build/distributions/ballerina-command-linux-${{ steps.version-set.outputs.version }}.zip | |
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-command-macos-${{ steps.version-set.outputs.version }}.zip | |
asset_path: build/distributions/ballerina-command-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-command-windows-${{ steps.version-set.outputs.version }}.zip | |
asset_path: build/distributions/ballerina-command-windows-${{ steps.version-set.outputs.version }}.zip | |
asset_content_type: application/octet-stream | |
- 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" |