Skip to content

Commit

Permalink
Merge pull request #21 from ballerina-platform/update-master
Browse files Browse the repository at this point in the history
Add missing isolated tag in stub template file
  • Loading branch information
niveathika authored Sep 22, 2020
2 parents 7f06e12 + 71b299a commit f53d9ae
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 42 deletions.
74 changes: 50 additions & 24 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,54 @@
name: Publish release

on:
release:
types: [published]
on: [workflow_dispatch, repository_dispatch]

jobs:
publish-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish artifact
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_STDLIB_TOKEN }}
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }}
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.BALLERINA_STDLIB_TOKEN }}
run: |
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
echo "New version: ${NEW_VERSION}"
echo "Github username: ${GITHUB_ACTOR}"
./gradlew -PpublishToCentral=true -Pversion=${NEW_VERSION} publish
publish-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set version env variable
run: echo ::set-env name=VERSION::$((grep -w "version" | cut -d= -f2) < gradle.properties | cut -d- -f1)
- 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/stdlib\(.*\)=\(.*\)-SNAPSHOT/stdlib\1=\2/g' gradle.properties
git add gradle.properties
git commit -m "Move dependencies to stable version" || echo "No changes to commit"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish artifact
env:
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }}
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.BALLERINA_STDLIB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
./gradlew release -Prelease.useAutomaticVersion=true
./gradlew -Pversion=${VERSION} publish -x test
- name: Create Github release from the release tag
run: |
curl --request POST 'https://api.github.com/repos/ballerina-platform/module-ballerina-grpc/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": "module-ballerina-grpc-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"
33 changes: 21 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id "com.github.spotbugs" version "4.0.5"
id "com.github.johnrengelman.shadow" version "5.2.0"
id "de.undercouch.download" version "4.0.4"
id "net.researchgate.release" version "2.6.0"
id "net.researchgate.release" version "2.8.0"
}

ext.ballerinaLangVersion = project.ballerinaLangVersion
Expand Down Expand Up @@ -233,21 +233,30 @@ subprojects {
ballerinaStdLibs "org.ballerinalang:task-ballerina:${stdlibTaskVersion}"
ballerinaStdLibs "org.ballerinalang:reflect-ballerina:${stdlibReflectVersion}"
}
}

release {
// Disable check snapshots temporarily
buildTasks = []
failOnSnapshotDependencies = false
failOnCommitNeeded = false
versionPropertyFile = 'gradle.properties'
tagTemplate = 'v${version}'
git {
// To release from any branch
requireBranch = null
}
def moduleVersion = project.version
if (moduleVersion.indexOf('-') != -1) {
moduleVersion = moduleVersion.substring(0, moduleVersion.indexOf('-'))
}

release {
failOnPublishNeeded = false

buildTasks = ['build']
versionPropertyFile = 'gradle.properties'
tagTemplate = 'v$version'

git {
requireBranch = "release-${moduleVersion}"
pushToRemote = 'origin'
}
}

task build {
dependsOn('grpc-ballerina:build')
}

task codeCoverageReport(type: JacocoReport) {
executionData fileTree(project.rootDir.absolutePath).include("**/build/coverage-reports/*.exec")

Expand Down
10 changes: 5 additions & 5 deletions grpc-ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ task ballerinaBuild {
workingDir project.projectDir
environment "JAVA_OPTS", "-DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true"
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "$distributionBinPath/ballerina.bat build ${additionalBuildParams} -c ${moduleName}"
commandLine 'cmd', '/c', "$distributionBinPath/ballerina.bat build ${additionalBuildParams} -c ${moduleName} && exit %%ERRORLEVEL%%"
} else {
commandLine 'sh', '-c', "$distributionBinPath/ballerina build ${additionalBuildParams} -c ${moduleName}"
}
Expand Down Expand Up @@ -272,7 +272,7 @@ task ballerinaBuild {
workingDir project.projectDir
environment "JAVA_OPTS", "-DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true"
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "$distributionBinPath/ballerina.bat push ${moduleName}"
commandLine 'cmd', '/c', "$distributionBinPath/ballerina.bat push ${moduleName} && exit %%ERRORLEVEL%%"
} else {
commandLine 'sh', '-c', "$distributionBinPath/ballerina push ${moduleName}"
}
Expand All @@ -284,7 +284,7 @@ task ballerinaBuild {
workingDir project.projectDir
environment "JAVA_OPTS", "-DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true"
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "$distributionBinPath/ballerina.bat doc --offline ${moduleName}"
commandLine 'cmd', '/c', "$distributionBinPath/ballerina.bat doc --offline ${moduleName} && exit %%ERRORLEVEL%%"
} else {
commandLine 'sh', '-c', "$distributionBinPath/ballerina doc --offline ${moduleName}"
}
Expand Down Expand Up @@ -317,8 +317,8 @@ publishing {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/ballerina-platform/module-ballerina-grpc")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
username = System.getenv("packageUser")
password = System.getenv("packagePAT")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{#enumList}}
{{> enum}}{{/enumList}}{{#if rootDescriptor}}
const string ROOT_DESCRIPTOR = "{{rootDescriptor}}";
function getDescriptorMap() returns map<string> {
isolated function getDescriptorMap() returns map<string> {
return {
{{#each descriptors}}"{{descriptorKey}}":"{{descriptorData}}"{{#unless @last}},{{/unless}}
{{/each}}
Expand Down

0 comments on commit f53d9ae

Please sign in to comment.