Publish release #19
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: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'ballerina-platform' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: 17.0.7 | |
- name: Build with Gradle | |
env: | |
packageUser: ${{ github.actor }} | |
packagePAT: ${{ secrets.GITHUB_TOKEN }} | |
run: ./gradlew build -x check -x test --stacktrace --console=plain | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
scan-type: 'fs' | |
scan-ref: '/github/workspace/ballerina/lib' | |
format: 'table' | |
timeout: '6m0s' | |
exit-code: '1' | |
- name: Set version env variable | |
run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $GITHUB_ENV | |
- 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} | |
sed -i 's/ballerinaLangVersion=\(.*\)-SNAPSHOT/ballerinaLangVersion=\1/g' gradle.properties | |
sed -i 's/ballerinaLangVersion=\(.*\)-[0-9]\{8\}-[0-9]\{6\}-.*$/ballerinaLangVersion=\1/g' gradle.properties | |
sed -i 's/stdlib\(.*\)=\(.*\)-SNAPSHOT/stdlib\1=\2/g' gradle.properties | |
sed -i 's/stdlib\(.*\)=\(.*\)-[0-9]\{8\}-[0-9]\{6\}-.*$/stdlib\1=\2/g' gradle.properties | |
git add gradle.properties | |
git commit -m "Move dependencies to stable version" || echo "No changes to commit" | |
- name: Publish artifact | |
env: | |
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} | |
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | |
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | |
publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
run: | | |
./gradlew clean release -Prelease.useAutomaticVersion=true --stacktrace --console=plain | |
./gradlew -Pversion=${VERSION} publish -x test -PpublishToCentral=true --stacktrace --console=plain | |
- name: GitHub Release and Release Sync PR | |
env: | |
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
run: | | |
gh release create v$VERSION --title "module-ballerina-observe-v$VERSION" | |
gh pr create --title "[Automated] Sync master after $VERSION release" --body "Sync master after $VERSION release" |