forked from ballerina-platform/ballerina-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (47 loc) · 1.87 KB
/
observe_package_push.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Push Ballerina Observe Package to Central
on:
workflow_dispatch:
inputs:
repoTag:
description: Ballerina Lang Tag
required: true
jobs:
publish-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Checkout Tag
run: git checkout ${{ github.event.inputs.repoTag }}
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
BAL_PROJECT=observelib/observe/src/main/ballerina
if [ ! -f "${BAL_PROJECT}/Package.md" ]; then
echo "Package.md does not exist. Copying Module.md as Package.md"
cp ${BAL_PROJECT}/Module.md ${BAL_PROJECT}/Package.md
fi
./gradlew build -x check -x test
- name: Publish artifact
env:
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }}
run: |
BAL_PROJECT=observelib/observe/src/main/ballerina
PACKAGE_VERSION=$((grep -w -m 1 'version' | cut -d= -f2) < "${BAL_PROJECT}/Ballerina.toml" | rev | tr -d '"' | tr -d ' ' | rev)
echo "Package Version: ${PACKAGE_VERSION}"
BALA_DIR=observelib/observe/build/ballerina-src/target/ballerina-observability/bala/ballerina/observe/${PACKAGE_VERSION}/any
pushd ${BALA_DIR}
zip -r observe-bala.zip *
popd
curl -v --fail -X POST -H "Content-Type:application/octet-stream" \
-H "Authorization: Bearer ${BALLERINA_CENTRAL_ACCESS_TOKEN}" \
--data-binary @"${BALA_DIR}/observe-bala.zip" https://api.central.ballerina.io/2.0/registry/packages