Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into doc-update
  • Loading branch information
RDPerera committed Feb 13, 2024
2 parents bb72fdb + 0c9da68 commit 02e11ba
Show file tree
Hide file tree
Showing 48 changed files with 411 additions and 692 deletions.
10 changes: 0 additions & 10 deletions .github/pull_request_template.md

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

on:
push:
branches:
- main
workflow_dispatch:

jobs:
ubuntu-build:
name: Build
runs-on: ubuntu-latest
concurrency:
group: ${{ github.head_ref }}-ubuntu-build
cancel-in-progress: true
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set Up Ballerina
uses: ballerina-platform/[email protected]
with:
version: latest

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7
- name: Change to Timestamped Version
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
latestCommit=$(git log -n 1 --pretty=format:"%h")
VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)
updatedVersion=$VERSION-$startTime-$latestCommit
echo $updatedVersion
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Set ENV Variables
run: |
echo -e '${{ toJson(secrets) }}' | jq -r 'to_entries[] | .key + "=" + .value' >> $GITHUB_ENV
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build the Package
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew build
- name: Generate Codecov Report
uses: codecov/codecov-action@v3
64 changes: 64 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release

on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Select environment
required: true
options:
- CENTRAL
- DEV CENTRAL
- STAGE CENTRAL

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7

- 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: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Publish artifact
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
BALLERINA_STAGE_CENTRAL: false
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
./gradlew release
- name: GitHub Release and Release Sync PR
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
gh release create v$VERSION --title "edi-tools-v$VERSION"
gh pr create --base main --title "[Automated] Sync main after $VERSION release" --body "Sync main after $VERSION release"
42 changes: 37 additions & 5 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,40 @@ concurrency:
on: pull_request

jobs:
call_workflow:
name: Run PR Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/pr-build-connector-template.yml@main
secrets: inherit
ubuntu-build:
name: Build
runs-on: ubuntu-latest
concurrency:
group: ${{ github.head_ref }}-ubuntu-build
cancel-in-progress: true
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set Up Ballerina
uses: ballerina-platform/[email protected]
with:
version: latest

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7

- name: Set ENV Variables
run: |
echo -e '${{ toJson(secrets) }}' | jq -r 'to_entries[] | .key + "=" + .value' >> $GITHUB_ENV
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build the Package
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew build
- name: Generate Codecov Report
uses: codecov/codecov-action@v3
66 changes: 0 additions & 66 deletions .github/workflows/release.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/stale-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Close stale pull requests'

on:
schedule:
- cron: '30 19 * * *'
workflow_dispatch:

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
stale-pr-message: 'This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the `stale` label is removed or commented.'
close-pr-message: 'Closed PR due to inactivity for more than 18 days.'
days-before-pr-stale: 15
days-before-pr-close: 3
days-before-issue-stale: -1
days-before-issue-close: -1
2 changes: 1 addition & 1 deletion build-config/resources/package/BalTool.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
id = "edi"

[[dependency]]
path = "resources/[email protected]@.jar"
path = "resources/edi-tools-[email protected]@.jar"
15 changes: 7 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,19 @@ subprojects {

def moduleVersion = project.version.replace("-SNAPSHOT", "")

release {
failOnPublishNeeded = false
task build {
dependsOn ":edi-tools-package:build"
dependsOn ":edi-tools-tests:test"
}

buildTasks = ["build"]
release {
failOnSnapshotDependencies = true
versionPropertyFile = 'gradle.properties'
tagTemplate = 'v$version'

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

task build {
dependsOn('edi-tools:build')
}
publish.dependsOn ":edi-tools-package:publish"
Loading

0 comments on commit 02e11ba

Please sign in to comment.