Publish release #248
This file contains hidden or 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: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21.0.3' | |
| - name: Setup GraalVM | |
| uses: graalvm/setup-graalvm@v1 | |
| with: | |
| java-version: '21.0.3' | |
| distribution: 'graalvm' | |
| components: 'native-image' | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| set-java-home: 'false' | |
| - name: Set version env variable | |
| run: | | |
| echo "VERSION=$(./gradlew properties | grep ^version: | cut -d\ -f2 | sed 's@-SNAPSHOT@@')" >> $GITHUB_ENV | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Publish artifact | |
| env: | |
| publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | |
| publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
| run: | | |
| git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }} | |
| git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }} | |
| git checkout -b release-${VERSION} | |
| ./gradlew build -x :jballerina-debugger-integration-test:test -Pversion=${VERSION} | |
| ./gradlew -Pversion=${VERSION} publish -x test --continue | |
| - name: Create Release Tag | |
| run: | | |
| git config --local user.name ${{ secrets.BALLERINA_BOT_USERNAME }} | |
| git config --local user.email ${{ secrets.BALLERINA_BOT_EMAIL }} | |
| git tag -a v${VERSION} -m "Release v${VERSION}" | |
| git push origin v${VERSION} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
| - name: Create Github release from the release tag | |
| run: | | |
| curl --request POST 'https://api.github.com/repos/ballerina-platform/ballerina-lang/releases' \ | |
| --header 'Accept: application/vnd.github.v3+json' \ | |
| --header 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \ | |
| --header 'Content-Type: application/json' \ | |
| --data-raw '{ | |
| "tag_name": "v'"$VERSION"'", | |
| "name": "ballerina-lang-v'"$VERSION"'" | |
| }' | |
| - 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" |