Skip to content

Daily build editor #123

Daily build editor

Daily build editor #123

name: Daily build editor
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *' # 07:30 in LK time (GMT+5:30)
jobs:
ubuntu-build:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17.0.7'
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '10.22.1'
- name: Checkout Dev Tools Repository
uses: actions/checkout@v3
with:
repository: ballerina-platform/ballerina-dev-tools
ref: flow_model
path: ballerina-dev-tools
- name: Build with Gradle
id: build-dev-tools
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
TEST_MODE_ACTIVE: true
run: |
cd ballerina-dev-tools
DEV_TOOLS_VERSION=$(grep "^version=" gradle.properties | cut -d'=' -f2)
echo "::set-output name=version::$DEV_TOOLS_VERSION"
./gradlew clean build --stacktrace --scan -x test --console=plain --no-daemon --continue publishToMavenLocal
cd ..
- name: Checkout Distribution Repository
uses: actions/checkout@v3
with:
repository: ballerina-platform/ballerina-distribution
path: ballerina-distribution
- name: Get daily docker version
id: version
run: echo "::set-output name=version::$(date +'%Y-%m-%d')"
- name: Get project version
id: project-version
run: |
cd ballerina-distribution
SHORT_VERSION=$((grep -w "version" | cut -d= -f2 | cut -d- -f1 | xargs) < gradle.properties)
DIST_VERSION=$((grep -w "version" | cut -d= -f2 | xargs) < gradle.properties)
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-$CODE_NAME
echo "::set-output name=version::$RELEASE_VERSION"
echo "::set-output name=sversion::$SHORT_VERSION"
echo "::set-output name=langversion::$LANG_VERSION"
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
TEST_MODE_ACTIVE: true
run: |
cd ballerina-distribution
sed -i "s/^devToolsVersion=.*/devToolsVersion=${{ steps.build-dev-tools.outputs.version }}/" gradle.properties
./gradlew clean build --stacktrace --scan -x test --console=plain --no-daemon --continue -x project-api-tests:test
- name: Create linux-deb
id: run_installers_deb
run: |
cd ballerina-distribution/installers/linux-deb
./build-ballerina-linux-deb-x64.sh -v ${{ steps.project-version.outputs.version }} -p ./../../ballerina/build/distributions
echo "Created linux-deb successfully"
- name: Create linux-rpm
id: run_installers_rpm
run: |
cd ballerina-distribution/installers/linux-rpm
./build-ballerina-linux-rpm-x64.sh -v ${{ steps.project-version.outputs.version }} -p ./../../ballerina/build/distributions
echo "Created linux-rpm successfully"
- name: Archive Ballerina ZIP
uses: actions/upload-artifact@v4
id: artifact-upload
with:
name: Ballerina ZIP
path: ballerina-distribution/ballerina/build/distributions/ballerina-*-swan-lake.zip
- name: Archive Ballerina Short Name ZIP
uses: actions/upload-artifact@v2
with:
name: Ballerina Short Name ZIP
path: ballerina-distribution/ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip
- name: Archive Linux deb
uses: actions/upload-artifact@v2
with:
name: Linux Installer deb
path: ballerina-distribution/installers/linux-deb/target/ballerina-*-linux-x64.deb
- name: Archive Linux rpm
uses: actions/upload-artifact@v2
with:
name: Linux Installer rpm
path: ballerina-distribution/installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm
- name: Archive MacOS Installer ZIP
uses: actions/upload-artifact@v2
with:
name: MacOS Installer ZIP
path: ballerina-distribution/ballerina/build/distributions/ballerina-*-macos.zip
- name: Archive MacOS-ARM Installer ZIP
uses: actions/upload-artifact@v2
with:
name: MacOS-ARM Installer ZIP
path: ballerina-distribution/ballerina/build/distributions/ballerina-*-macos-arm.zip
- name: Archive Windows Installer ZIP
uses: actions/upload-artifact@v2
with:
name: Windows Installer ZIP
path: ballerina-distribution/ballerina/build/distributions/ballerina-*-windows.zip
- name: Send release notification
shell: bash
run: |
body=$(cat << EOF
{
"cards": [
{
"header": {
"title": "Daily Build",
},
"sections": [
{
"widgets": [
{
"keyValue": {
"topLabel": "Ballerina Distribution",
"content": "v${{ steps.project-version.outputs.langversion }}",
"onClick": {
"openLink": {
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
},
"iconUrl": "https://lh6.googleusercontent.com/proxy/R9Rx8vYNd-_HZn58ckf5PNX7RMlC6P-B75fB7UQ_GFH5R0UwtfJ1gVNARBvH1us8LBuK4NVFsvMGnwZkm-H2_9ACwH_j0lQmExR1SRMNGlFcbrm_1O7foFpqqOiVzA",
"button": {
"textButton": {
"text": "Download ZIP",
"onClick": {
"openLink": {
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.artifact-upload.outputs.artifact-id }}"
}
}
}
}
}
}
]
}
]
}
]
}
EOF
)
curl \
-X POST \
-H 'Content-Type: application/json' \
"https://chat.googleapis.com/v1/spaces/AAAApvQDm3o/messages?key=${{ secrets.EDITOR_CHAT_BOT_KEY }}&token=${{ secrets.EDITOR_CHAT_BOT_TOKEN }}" \
-d "$body"