Skip to content

Commit

Permalink
feat: mediator initial release (#4)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Baliasnikov <anton.baliasnikov@iohk.io>
Signed-off-by: Shailesh <Patil>
  • Loading branch information
2 people authored and Shailesh committed Apr 30, 2024
1 parent 1310f81 commit 1256f43
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
branches: [main]
# tags: ["v*"]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
Run-Tests:
name: CI
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release

concurrency:
group: release

on:
workflow_call:
inputs:
release-branch:
required: false
type: string
default: "main"
workflow_dispatch:
inputs:
release-branch:
description: "Branch to release from"
required: false
default: "main"

jobs:
release:
env:
GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ATALA_GITHUB_TOKEN }}
ref: ${{ github.event.inputs.release-branch }}
fetch-depth: 0
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
with:
java-version: openjdk@1.11
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- uses: crazy-max/ghaction-import-gpg@v3
id: import_gpg
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
git-user-signingkey: true
git-commit-gpgsign: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.ATALA_GITHUB_ACTOR }}
password: ${{ secrets.ATALA_GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Release
env:
GIT_AUTHOR_EMAIL: ${{ steps.import_gpg.outputs.email }}
GIT_COMMITTER_EMAIL: ${{ steps.import_gpg.outputs.email }}
GIT_AUTHOR_NAME: ${{ steps.import_gpg.outputs.name }}
GIT_COMMITTER_NAME: ${{ steps.import_gpg.outputs.name }}
run: |
npm install
npx semantic-release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.bloop/
.metals/
.bsp/
.idea/
.vscode/
project/metals.sbt
project/project/
Expand Down
Empty file added CHANGELOG.md
Empty file.
14 changes: 14 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,17 @@ lazy val mediator = project
)
// .jvmConfigure(e => e.dependsOn(httpUtils))
.dependsOn(httpUtils.jvm) // did, didExample,

// ############################
// #### Release process #####
// ############################
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations.*
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
ReleaseStep(releaseStepTask(mediator / Docker / stage)),
setNextVersion
)
84 changes: 84 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"name": "atala-prism-mediator",
"version": "0.1.0",
"engines": {
"node": ">=16.13.0"
},
"devDependencies": {
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"conventional-changelog-conventionalcommits": "^5.0.0",
"gradle-semantic-release-plugin": "1.7.3",
"husky": "^8.0.1",
"pinst": "^3.0.0",
"prettier": "^2.7.1",
"semantic-release": "^19.0.3",
"semantic-release-slack-bot": "^3.5.3"
},
"release": {
"branches": [
{
"name": "main"
},
{
"name": "prerelease/*",
"prerelease": "snapshot"
}
],
"tagFormat": "prism-mediator-v${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"prepareCmd": "npm version ${nextRelease.version} --git-tag-version false"
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "docker buildx build --platform=linux/arm64,linux/amd64 --push -t ghcr.io/input-output-hk/atala-prism-mediator:${nextRelease.version} ./did-mediator/target/docker/stage"
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"version.sbt",
"CHANGELOG.md",
"package.json",
"package-lock.json"
],
"message": "chore(release): cut prism mediator ${nextRelease.version} release\n\n${nextRelease.notes}"
}
],
[
"semantic-release-slack-bot",
{
"notifyOnSuccess": true,
"notifyOnFail": true,
"markdownReleaseNotes": true,
"onSuccessTemplate": {
"text": "A new version of Atala PRISM Mediator successfully released!\nVersion: `$npm_package_version`\nTag: $repo_url/releases/tag/$npm_package_version\n\nRelease notes:\n$release_notes"
}
}
]
]
}
}
9 changes: 9 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,12 @@ addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4")

// Deploy demo
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.1")

// Release
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")

// Github Packages
addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3")

// Native Packager
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11")
1 change: 1 addition & 0 deletions version.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ThisBuild / version := "0.1.0-SNAPSHOT"

0 comments on commit 1256f43

Please sign in to comment.