Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add release workflow #8

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cicd:
- '.github/workflows/*'

scripts:
- 'scripts/*'

test:
- 'test/**'

documentation:
- '**/*.md'

docker:
- 'docker/**'

25 changes: 25 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# .github/release.yml

changelog:
exclude:
labels:
- cicd
- scripts
- test
categories:
- title: Breaking Changes 🛠
labels:
- Major
- breaking-change
- title: New Features 🎉
labels:
- Minor
- enhancement
- Feature
- title: Bug Fixes 🐛
labels:
- Patch
- bug
- title: Other Changes 📝
labels:
- "*"
33 changes: 33 additions & 0 deletions .github/workflows/auto-pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Pull Request Labeler
on:
pull_request:
types:
- opened
- edited
- synchronize
jobs:
auto-label:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Find Current Pull Request
uses: jwalton/gh-find-current-pr@v1.3.2
id: findPr
with:
# Can be "open", "closed", or "all". Defaults to "open".
state: open
- run: echo "PR Number is ${PR}"
if: success() && steps.findPr.outputs.number
env:
PR: ${{ steps.findPr.outputs.pr }}

- name: check pr pr-number
run: echo ${{ github.event.number }}

- uses: actions/labeler@v4
with:
dot: true
pr-number: ${{ steps.findPr.outputs.pr }}

21 changes: 21 additions & 0 deletions .github/workflows/check-pr-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: PR Label Checker
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled

jobs:

check_labels:
name: Check PR labels
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
any_of: documentation,enhancement,bug,cicd,test,breaking-change,feature,scripts
repo_token: ${{ secrets.GITHUB_TOKEN }}

18 changes: 18 additions & 0 deletions .github/workflows/lint-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint PR
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: true
validateSingleCommitMatchesPrTitle: true
75 changes: 75 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Release
on:
push:
tags:
- '*'
permissions:
contents: write
packages: write
repository-projects: write

jobs:
build_javascore:
name: Build Javascore Contracts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Build Javascore Contracts
run: |
./gradlew clean build
./gradlew optimizedJar
./gradlew zipOutputOptimizedJars
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: javascore-contracts
path: ./build/javascore-contracts.zip

release:
name: Release and Publish
runs-on: ubuntu-latest
needs:
- build_javascore
steps:
- name: Initialize variables
id: vars
run: |
echo «::set-output name=date::$(date +'%Y-%m-%d')»
echo «::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)»
- name: Download Javascore Artifacts
uses: actions/download-artifact@v2
with:
name: javascore-contracts
path: javascore-contracts

- name: Unzip Javascore Artifacts
run: unzip javascore-contracts/javascore-contracts.zip -d javascore-contracts && rm -rf javascore-contracts/javascore-contracts.zip

- name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: Changelog
env:
REPO: ${{ github.repository }}

- name: Generate checksum
uses: jmgilman/actions-generate-checksum@v1
with:
patterns: |
javascore-contracts/*.jar
output: check256sums.txt

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
${{ steps.Changelog.outputs.changelog }}
files: |
./javascore-contracts/*.jar
check256sums.txt
1 change: 0 additions & 1 deletion buckets/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,3 @@ task integrationTest(type: Test) {

}


19 changes: 19 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,23 @@ gradle.taskGraph.whenReady { taskGraph ->
}


task collectOptimizedJars(type: Copy) {
from subprojects.collect { subproject ->
subproject.fileTree('build/libs') {
include '**/*-optimized.jar'
}
}
into "$buildDir/output-jars"
}

task zipOutputOptimizedJars(type: Zip) {
dependsOn collectOptimizedJars
from("$buildDir/output-jars") {
include '**/*-optimized.jar'
}
archiveFileName = "javascore-contracts.zip"
destinationDirectory = file("$buildDir")
}



1 change: 1 addition & 0 deletions insurance/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jacocoTestReport {
}

optimizedJar {
dependsOn project(':score-lib').jar
mainClassName = 'icon.inflation.score.insurance.Insurance'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
Expand Down
3 changes: 3 additions & 0 deletions network-owned-liquidity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jacocoTestReport {
}

optimizedJar {
dependsOn project(':score-lib').jar
mainClassName = 'icon.inflation.score.nol.NetworkOwnedLiquidity'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
Expand Down Expand Up @@ -83,3 +84,5 @@ task integrationTest(type: Test) {
}

}


3 changes: 2 additions & 1 deletion savings-rate/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jacocoTestReport {
}

optimizedJar {
dependsOn project(':score-lib').jar
mainClassName = 'icon.inflation.score.savings.SavingsRate'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
Expand Down Expand Up @@ -82,4 +83,4 @@ task integrationTest(type: Test) {
systemProperty "java", optimizedJar.outputJarName
}

}
}
Loading